Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/73.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
用于提取值的R循环_R_Dplyr_Data.table_Lapply_Mapply - Fatal编程技术网

用于提取值的R循环

用于提取值的R循环,r,dplyr,data.table,lapply,mapply,R,Dplyr,Data.table,Lapply,Mapply,我希望的输出将显示三列——变量、系数、标准误差: 那么: ATTEMPT = lapply(1:length(models), function(x) { cbind(cov, coef(summary(models[[x]]))[2,1:2])}) ATTEMPT2=lappy(1:长度(型号)、函数(x){ cf将更容易将数据重新格式化为长格式,并使用包nlme中的lmList& ATTEMPT = lapply(1:length(models), f

我希望的输出将显示三列——变量、系数、标准误差:

那么:

ATTEMPT = lapply(1:length(models), function(x) {
                   cbind(cov, coef(summary(models[[x]]))[2,1:2])})
ATTEMPT2=lappy(1:长度(型号)、函数(x){

cf将更容易将数据重新格式化为长格式,并使用包nlme中的lmList&
ATTEMPT = lapply(1:length(models), function(x) {
                   cbind(cov, coef(summary(models[[x]]))[2,1:2])})
ATTEMPT2 = lapply(1:length(models), function(x) {
                    cf <- coef(summary(models[[x]]))
                    data.frame(Variable=rownames(cf)[2], 
                               Estimate=cf[2,1],
                               Std.Error=cf[2,2])})
(df2 <- do.call("rbind", ATTEMPT2))
#   Variable  Estimate  Std.Error
# 1    write 0.6455300 0.06168323
# 2     math 0.7248070 0.05827449
# 3  science 0.6525644 0.05714318
# 4    socst 0.5935322 0.05317162