【问题标题】:How to apply a function over several matrices in R如何在 R 中的多个矩阵上应用函数
【发布时间】:2012-11-08 14:00:10
【问题描述】:

我想在几个矩阵上应用一个函数,输出应该是列表或向量,报告每个操作的结果。 所以我的尝试是使用 mapply 并且看起来像这样:

    myfunction<-function(x){cor(df1,x)
    output.list<-mapply(myfunction(df2,df3))

但这并没有成功。有什么想法吗??

【问题讨论】:

    标签: r function matrix


    【解决方案1】:

    试试这个lapply(list(df2, df3), myfunction)

    【讨论】:

      猜你喜欢
      • 2013-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-05
      • 2016-07-04
      • 2018-03-11
      相关资源
      最近更新 更多