[R] subset dataframe/list

Cecilia Carmo cecilia.carmo at ua.pt
Mon Jun 1 19:01:20 CEST 2009


Hi R-helpers!

I have the following object:
> head(coeficientes)
     caedois           b1           b2           b3
1       1    0,033120395 -20,29478338 -0,274638864
2       2   -0,040629634  74,54239889 -0,069958424
3       5   -0,001116816   35,2398622  0,214327185
4      10     0,171875
5      14   0,007288399  40,06560548 -0,081828338
6      15   0,027530346  0,969969409  0,102775555

I´ve tried to subset it like this:
>coefSelected<-subset(coeficientes,"b1">0) 
but it does nothing

Then I’ve tried:
> coefSelected<-subset(coeficientes,b1>0)
But I´ve got the following
Warning message:
In Ops.factor(b1, 0) : > not meaningful for factors

So I’ve tried:
> coefSelected<-subset(coeficientes,coeficientes$b1>0)
Warning message:
In Ops.factor(coeficientes$b1, 0) : > not meaningful for 
factors

  I´ve done
>mode(coeficientes)
[1] "list"

But I don´t know how to handle it!
Coul anyone help me?
Thanks,

Cecília Carmo (Universidade de Aveiro – Portugal




More information about the R-help mailing list