Hi Lisa,
Try the following -- there are probably better solutions, but these seem
to work.
Hank Stevens
Miami University
Oxford, OH, USA
a <- vector("list",3)
names(a) <- 1:3
a[[1]] <- data.frame(x1=3,x2=1)
a[[2]] <- data.frame(x1=c(3,3),x2=c(2,2))
a[[3]] <- data.frame(x1=c(3,3), x2=c(3,3))
a
unlist(sapply(a, function(x) x$x1 ))
unlist(sapply(a, function(x) x[,1] ))
Lisa Wang wrote:
>Hello,
>
>I have a list "lis" as the following:
>
>$"1"
> x1 x2
>4 3 1
>
>$"2"
> x1 x2
>3 3 2
>5 3 2
>
>$"3"
> x1 x2
>2 3 3
>6 3 3
>
>How do I get the x1 varible? for example ss"1"
>
>
>
>------------------------------------------------------------------------
>
>This e-mail may contain confidential and/or privileged information for the
sole use of the intended recipient. Any review or distribution by anyone other
than the person for whom it was originally intended is strictly prohibited. If
you have received this e-mail in error, please contact the sender and delete all
copies. Opinions, conclusions or other information contained in this e-mail may
not be that of the organization.
>
>------------------------------------------------------------------------
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>