[R] subsetting tables
netzwerkerin
lehmannk at informatik.uni-tuebingen.de
Tue Sep 6 16:10:03 CEST 2011
Hi guys,
one of the questions where you need a real human instead of a search engine,
so it would be great if you could help.
I have a matrix of z-scores which I would like to filter, sometimes
columnwise, sometimes rowwise. Data looks like this:
Allstar hsa.let.7a hsa.let.7a.1 hsa.let.7a.2
2 0.87 0.79 -0.57 1.07
3 0.67 -1.14 -0.78 -0.95
4 -0.46 -0.30 -0.36 1.14
Now I want to find all elements which are below/above some threshold. Subset
works fine with the columns:
> subset(red[,4], red[,4] > 0.5)
[1] 1.07 1.14
But not with the rows:
> subset(red[2,], red[2,] > 0.5)
Allstar hsa.let.7a hsa.let.7a.1 hsa.let.7a.2
3 0.67 -1.14 -0.78 -0.95
If I try to find all values above 0.5 (any row, any column, I just need the
number of entries), this is what I try (and get):
> subset(red[,], red[,] > 0.5)
Allstar hsa.let.7a hsa.let.7a.1 hsa.let.7a.2
2 0.87 0.79 -0.57 1.07
3 0.67 -1.14 -0.78 -0.95
NA NA NA NA NA
NA.1 NA NA NA NA
NA.2 NA NA NA NA
Obviously I'm doing something wrong, but what?
Help very much appreciated.
Netzwerkerin
--
View this message in context: http://r.789695.n4.nabble.com/subsetting-tables-tp3793509p3793509.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list