Hello, Your post is unreadable, please repost in *plain text*, not HTML.
Rui Barradas Às 16:00 de 09/04/20, aiguo li via R-help escreveu:
Hello allI need to create a r list with each row as a list object and named with the element in the first column. Illustrated below:> a<- as.data.frame(matrix(LETTERS[1:16],nrow = 4))> a V1 V2 V3 V41 A E I M2 B F J N3 C G K O4 D H L P I want the list looks like$A[1] E I MLevels: E I M $B[1] F J NLevels: F J N $C[1] G K OLevels: G K O $D[1] H L PLevels: H L P I used the script below, it does not work the way I wantlapply(split(a,a$V1), function(x) as.list(a[-1])) any help would be greatly appreciated! Anna [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.