correlation between columns by group

后端 未结 3 1935
暗喜
暗喜 2021-01-27 17:06

How do I calculate correlations between one column and all other columns in a data frame in R without using column names? I tried to use ddply and it works if I use just two col

3条回答
  •  隐瞒了意图╮
    2021-01-27 17:36

    Maybe like this? It produces a correlation matrix for each species.

    by(iris[,1:4], iris$Species, cor)

提交回复
热议问题