Dear list, I am running some linear regressions through lapply,
>lapply(c('EMAX','EC50','KOUT','GAMMA'),function(x)confint(lm(get(x)~RR0,dataset2))) I got results like [[1]] 2.5 % 97.5 % (Intercept) 0.6595789212 0.8821691261 RR0 -0.0001801771 0.0001489083 [[2]] 2.5 % 97.5 % (Intercept) -63.83694930 76.5489503 RR0 -0.01515098 0.1924006 [[3]] 2.5 % 97.5 % (Intercept) 3.387021548 5.3828732564 RR0 -0.002202969 0.0007477704 [[4]] 2.5 % 97.5 % (Intercept) -7.75121986 15.20827567 RR0 -0.01174097 0.02220318 How do I put names into the lapply results, something like 'EMAX' 2.5 % 97.5 % (Intercept) 0.6595789212 0.8821691261 RR0 -0.0001801771 0.0001489083 'EC50' 2.5 % 97.5 % (Intercept) -63.83694930 76.5489503 RR0 -0.01515098 0.1924006 'KOUT' 2.5 % 97.5 % (Intercept) 3.387021548 5.3828732564 RR0 -0.002202969 0.0007477704 'GAMMA' 2.5 % 97.5 % (Intercept) -7.75121986 15.20827567 RR0 -0.01174097 0.02220318 Thanks a lot. Jun Shen ========================================================= structure(list(ID = c(50, 51, 52, 53, 55, 56, 57, 59, 60, 61, 100, 101, 104, 107, 108, 110, 112, 114), KOUT = c(3.8336, 3.7519, 3.7136, 3.3477, 4.9429, 4.495, 3.4988, 3.7722, 3.6962, 4.1295, 3.7326, 3.1477, 4.0665, 4.9775, 3.9306, 4.1424, 2.4429, 4.9216 ), RR0 = c(375.05, 399.72, 361.12, 603.08, 604.01, 474.13, 1051.9, 924.9, 576.37, 745.75, 736.03, 757.49, 417.78, 437.7, 477.02, 1063, 813.8, 706.52), EMAX = c(0.7075, 0.73029, 0.72402, 0.70303, 0.70725, 0.83351, 0.71868, 0.69435, 0.74215, 0.67479, 0.87452, 0.68746, 0.75182, 0.83598, 0.80434, 0.7556, 0.87361, 0.87664), EC50 = c(19.813, 17.438, 17.969, 23.253, 17.761, 29.409, 46.527, 48.845, 42.641, 47.584, 50.216, 89.968, 94.194, 80.707, 126.39, 172.23, 159.94, 50.957), GAMMA = c(3.9114, 2.0886, 4.687, 1.9983, 33.763, 3.1611, 3.8281, 8.3482, 2.4175, 5.9436, 2.821, 5.7756, 6.2762, 3.9233, 6.298, 10.219, 11.412, 10.532 ), DV = c(391.5, 410.5, 336.5, 586.5, 469.5, 490, 982.5, 910.5, 631.5, 711.5, 850.5, 706.5, 414, 469.5, 496.5, 1116.5, 889, 772.5)), .Names = c("ID", "KOUT", "RR0", "EMAX", "EC50", "GAMMA", "DV"), row.names = c(NA, -18L), class = "data.frame")->dataset2 [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.