s-news
[Top] [All Lists]

how to extract the elements of a list of vectors in a fixed position?

To: s-news@lists.biostat.wustl.edu
Subject: how to extract the elements of a list of vectors in a fixed position?
From: carol white <wht_crl@yahoo.com>
Date: Thu, 15 Nov 2007 10:13:03 -0800 (PST)
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=W34xlLDJdweIAZls9iEgI4tNf4s3dSXOxtRg9U7IIC4p1yFHvMyhD67ZTHhC0wNeaYGmZ05im3mB1wHiqXhhgDGY34aVCfqEOutCkRQo2CeIw5QZ3X5y89tHRG/Ncnlfe1FnWgEZM0ZAvSs07Q3+oFCWngfgC54SOmkhHKigR7Y=;
Hi,
How is it possible to extract the elements of a list of vectors in a fixed position? suppose that I have a list of 2-element vectors, how can I extract the 2nd element of all vectors in the list? Can it be done with indexing and not by element name because my elements don't have name?

Thanks

carol

So in this example, I want to extract 2 and 4
v = list (c(1,2), c(3, 4))
 
> v
[[1]]
[1] 1 2

[[2]]
[1] 3 4


Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how.
<Prev in Thread] Current Thread [Next in Thread>