[R] subsetting tables

netzwerkerin lehmannk at informatik.uni-tuebingen.de
Tue Sep 6 22:24:28 CEST 2011


Hi Jannis, 

and thanks for the quick answer


jannis-2 wrote:
> 
> 
> which(red > 0.5)
> 
> 

this works but what are the actual numbers that are spit out? Because the
next step:


jannis-2 wrote:
> 
> 
> red[which(red > 0.5)] 
> 

does not work. It gives an 

Error in `[.data.frame`(tableReduced, which(tableReduced[, -1] > 0.5)) : 
  undefined columns selected

and if I change it in: 

red[which(red > 0.5), ]

to select all columns (which is of course not really what I would want
here), it spits out a lot of NA values although there is not a single one in
the original table. Any idea what happens here?




Regarding your question: "why don't you just ... " can almost always be
answered with: because I did not know ... ;-) No, really, as a newbie to R
and even if one has extensive knowledge of another programming language (or
maybe because of that) it is difficult in the beginning  to get your head
around the very fascinating but different R philosophy. So, I'm grateful for
this great help this list provides so fast. 




--
View this message in context: http://r.789695.n4.nabble.com/subsetting-tables-tp3793509p3794485.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list