[R] filter rows by value

Rui Barradas ruipbarradas at sapo.pt
Fri May 17 23:28:35 CEST 2013


Hello,

Try the following.


dat <- read.table(text = "
Var   Time
1           51
2          151
3           251
4            234
5           331
6            351
", header = TRUE)

dat[dat$Time %% 100 == 51, ]



Em 17-05-2013 22:01, Ye Lin escreveu:
> Hey All,
>
> I want to delete rows based on the last 2 digits on the value in one column
> but I dont know how to do that.
>
> Suppose my data looks like this:
>
> Var   Time
> 1           51
> 2          151
> 3           251
> *4            234*
> *5           331*
> 6            351
>
> I want to delete the rows that the value in column "Time", the last 2 digit
> is not 51, in this case the rows highlighted will be removed.
>
> Thanks for your help!
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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