[R] Plot only a subset of all factors in dataframe

Laura Hollink laurah at cs.vu.nl
Fri Jan 4 18:11:41 CET 2008


Hi all,
I have a dataframe called 'table' in which both factors and numerical 
values are stored.

 > dim(table)
[1] 990   6

The fist 10 lines of table, to get an idea:

 > table[1:10,]
   QueryNo    Query  type Ret Prec  Rec
1        1   Sports exact   1    1 0.01
2        5   Office exact   0  NaN 0.00
3        6  Meeting exact   0  NaN 0.00
4        7   Studio exact   0  NaN 0.00
5        9 Building exact   0  NaN 0.00
6       10   Desert exact   1    1 0.01
7       12 Mountain exact   0  NaN 0.00
8       13     Road exact   0  NaN 0.00
9       14      Sky exact   0  NaN 0.00
10      15     Snow exact   0  NaN 0.00

I want to plot column 5 (numerical values) against column 3 (factors).

plot(table[,c(3,5)]) works fine.

However, I don't want to include all 30 levels of the factor in the 
plot. I would like a plot of just 5 factors: "exact", "broader1", 
"narrower4", etc.

Could anyone tell me how to do this, or where to find information about 
this?

Thanks!
Laura




More information about the R-help mailing list