[R] how to extract the elements of a list of vectors in a fixedposition?

Greg Snow Greg.Snow at intermountainmail.org
Thu Nov 15 21:44:09 CET 2007



[snip]
> 
> or (I can't resist)
> 
> 	unlist(lapply(v,function(x,i){x[i]},i=2)) # For more 
> flexibility.

Well, if we are not resisting the fun ones then try:

	sapply( v, `[`, i=2)

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 



More information about the R-help mailing list