Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
拥有data.frames列表,需要跨列表元素的方法_R - Fatal编程技术网

拥有data.frames列表,需要跨列表元素的方法

拥有data.frames列表,需要跨列表元素的方法,r,R,我有一个数据列表。框架结构如下: mylist <- list(x=data.frame(group=1:3, x=c(43, 29, 49)), y=data.frame(group=1:3, x=c(29, 39, 11)), z=data.frame(group=1:3, x=c(20, 38, 98))) mylist试试看 或 或 根据OP的帖子中显示的输出 (43+29+20)/3 #[1] 30.66667

我有一个
数据列表。框架结构如下:

mylist <- list(x=data.frame(group=1:3, x=c(43, 29, 49)),
               y=data.frame(group=1:3, x=c(29, 39, 11)),
               z=data.frame(group=1:3, x=c(20, 38, 98)))
mylist试试看

根据OP的帖子中显示的输出

 (43+29+20)/3
 #[1] 30.66667

 (29+39+38)/3
 #[1] 35.33333

 (49+11+98)/3
 #[1] 52.66667
试一试

根据OP的帖子中显示的输出

 (43+29+20)/3
 #[1] 30.66667

 (29+39+38)/3
 #[1] 35.33333

 (49+11+98)/3
 #[1] 52.66667

dim

rowMeans(simplify2array(unlist(mylist, rec=F))[,c(F,T)])
或者,明确地

rowMeans(`dim<-`(unlist(mylist), dim(mylist[[1]])*c(1, length(mylist)))[,c(F, T)])
# [1] 30.66667 35.33333 52.66667

rowMeans(`dim玩
dim

rowMeans(simplify2array(unlist(mylist, rec=F))[,c(F,T)])
或者,明确地

rowMeans(`dim<-`(unlist(mylist), dim(mylist[[1]])*c(1, length(mylist)))[,c(F, T)])
# [1] 30.66667 35.33333 52.66667

rowMeans(`DIM)第一个不起作用,因为它输出一个数字,我想要三个数字。每行一个第一个不起作用,因为它输出一个数字,我想要三个数字。每行一个