[R] Extracting values in table

Ramnath sairam.bt at gmail.com
Fri Aug 26 17:52:15 CEST 2011


Hi All,

I am a beginner in programming in r and please do forgive me if my question
seems to be silly and sometimes not understandable. 

1. we have a list of elements in a list say:

ls<-list("N","E","E","N","P","E","M","Q","E","M")

2. We have an another list of tables in a list say:

n <- list("M", "N","E","P","Q","M","N","E","Q","N")

tb <- lapply(1:10, function(i)matrix(sample(4), 2, 2,
dimnames=list(n[sample(10,2)], n[sample(2,2)])))

3. we need to extract values from the table in the list where colname is
always "M" , wherein the rowname should be the 1st element in the list ls
for table 1 in the list tb and 2nd element in table 2 and so on...

for ex:  
   M N
N 4 1
P 3 2

In table 1 , we need to extract value 4.


Thanks to all in advance.




--
View this message in context: http://r.789695.n4.nabble.com/Extracting-values-in-table-tp3771272p3771272.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list