[R] Filter data

mohamed.lajnef at inserm.fr mohamed.lajnef at inserm.fr
Thu Dec 2 22:54:57 CET 2010


Hi Diogenas,

Try this,
data<-subset(poli, poli$year>1994)

Best,
M

Diogenas <diogenas at gmail.com> a écrit :

>
> Hello,
> I understand that question is probably stupid, but ...
>
> I have data (polity IV index)
> "country","year","democ","autoc","polity","polity2"
> "1","Afghanistan             ",1800,1,7,-6,-6
> "2","Afghanistan             ",1801,1,7,-6,-6
> "3","Afghanistan             ",1802,1,7,-6,-6
>
> I need to create new data sets which includes only cases after year 1995.
> I've tried this command:
> poli2<-poli[poli$year > 1994,] ,
>  however it generated this:
> Error in poli[poli$year > 1994, ] : incorrect number of dimensions.
> Any ideas how i can overcome this?
>
> Thank in advance for your help,
>
>
>
>
>
> -----
> Diogenas
> --
> View this message in context:   
> http://r.789695.n4.nabble.com/Filter-data-tp3070069p3070069.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list