简体   繁体   中英

How to apply a function over several matrices in R

I would like to apply a function over several matrices and the output should be list or vector reporting the result of each operation. so my attemp was with mapply and looked like this:

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

but this didn't work out. Any ideas??

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM