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

Rolf Turner r.turner at auckland.ac.nz
Thu Nov 15 22:09:49 CET 2007


On 16/11/2007, at 9:44 AM, Greg Snow wrote:

>
>
> [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)

	Admittedly *much* cooler than my somewhat kludgy effort.

		cheers,

			Rolf

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list