[R] filter out observation by condition

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Jul 18 10:38:46 CEST 2007



sigalit mangut-leiba wrote:
> hello,
> I have a longitudinal data:
> idn     mort30      newinfec
> 1           0               1
> 1           0               1
> 1           0               1
> 1           0               1
> 2           1               1
> 2           1               1
> 2           1               1
> 3           0               0
> 3           0               0
> 3           0               0
> 3           0               0
> 3           0               0
> 
> and i want to filter out those obs. that has mort30==1 (mort30 is constant
> over idn).
> how can i use "if...else" and filter out those unwanted obs.?
> I appriciate the help,
> sigalit.


subset(data, mort30 != 1)

Uwe Ligges



> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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