【问题标题】:Problems using merge_all from the 'reshape' package in R在 R 中使用“reshape”包中的 merge_all 时出现问题
【发布时间】:2014-09-28 19:09:02
【问题描述】:

我有一个变量d.merg.hosp.aucs.list,其中包含 100 个lists,每个包含 8 个整数值。我想对所有这些值执行quantile(),所以我这样做了:

d.merg.hosp.aucs.list

merge_all 是来自reshape 包的内置函数。但是,在我运行完该代码后,我检查了所有列表是否合并

>d.merg.hosp.aucs.list 但我知道了:

data frame with 0 columns and 0 rows

我哪里做错了?

这是d.merg.hosp.aucs 中前 10 个列表的可重现示例:

d.merg.hosp.aucs

【问题讨论】:

    标签: r list merge reshape


    【解决方案1】:

    这是一个向量列表,而不是 data.frames。如果我理解正确,您希望将所有值组合成一个向量以传递给 quantile()。您可以将其unlist 转换为数字向量。

    quantile(unlist(d.merg.hosp.aucs))
           0%       25%       50%       75%      100% 
    0.0000000 0.4166667 0.5327381 0.6510417 1.0000000 
    

    【讨论】:

      猜你喜欢
      • 2019-08-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多