【问题标题】:R - could not find function 'melt()' [duplicate]R - 找不到函数'melt()' [重复]
【发布时间】:2012-04-03 09:48:07
【问题描述】:

可能重复:
Error: could not find function … in R

我在 R 的 stackoverflow 中找到了对函数 melt() 的各种引用,实际上是 melt.data.frame()。但是当我在 R 中调用它时,它给了我

Error: could not find function "melt"

如何加载该函数以便调用它?

【问题讨论】:

  • 请完整解释问题
  • 你需要install.packages("reshape"); library(reshape)
  • 你可以通过rseek.org搜索找到答案。
  • install.packages("sos"); library("sos"); findFn("melt.data.frame")(但这里存在递归问题,因为您必须知道如何安装和加载sos 包才能使用它来搜索melt.data.frame ...
  • 这也是“melt cran”的第一个谷歌搜索

标签: r


【解决方案1】:

melt 函数可以在 reshape 包中找到。

如果您没有安装该软件包,则需要使用install.packages("reshape") 安装它,然后才能使用它。然后,在安装包后,使用library(reshape) 使其可用。到时候你就可以开始了!

2018 年更新:R 3.6.1 中的包。现在称为reshape2

reshape2 注释还说:

reshape2 已退役:只有将其保留在 CRAN 上所需的更改才会 做出来。我们建议使用tidyr 而是。

tidyr 不包含melt 函数。

【讨论】:

  • @Mr.T 在这种情况下请编辑答案
猜你喜欢
  • 2018-04-16
  • 2012-11-30
  • 1970-01-01
  • 2015-03-20
  • 1970-01-01
  • 1970-01-01
  • 2017-06-27
  • 2013-09-07
  • 2018-05-16
相关资源
最近更新 更多