r - Subset simulated data -
i have simulated info has 7 studies , huge file. contains columns of:
> sim.data time conc study 0 2 7 0.5 5 8 1 8 9 2 8 9 0 10 10 0.5 12 10 5 15 10
i want discard time , concentration info of studies 7,8 9 times less or euqal 1 hour. how can utilize subset function in 1 shot? like;
simdata <- subset (simdata, discard info times <= 1 hr stduy <10 only)
or alternatively,
simdata <- subset (simdata, consider time>1 study <10 study >=10)
thanks.
you cannot discard time values, can set them na:
sim.data$time<-ifelse(sim.data$study<10 & sim.data$time<=1, na, sim.data$time)
if want remove rows such status satisfied,
newdata <- sim.data[!(sim.data$study<10 & sim.data$time<=1),]
r
No comments:
Post a Comment