[R] Subset for plot in R
arun
smartpink111 at yahoo.com
Mon Feb 17 17:18:19 CET 2014
Hi,
Try:
set.seed(49)
dat1 <- data.frame(year= rep(2010:2013,c(10,8,9,13)),x=sample(1e4,40,replace=TRUE),y=sample(40,40,replace=TRUE))
plot(x~y,data=dat1,subset=year > 2012)
#or
with(subset(dat1,year > 2012),plot(y,x))
A.K.
Hi R people
This might take me the whole day to figure out, instead I will ask so I can save some PhD time.
I want to plot a subset of my data.
x = area
y = concentration
these data are sorted by
z = year (2008 to 2013)
So I want to make a plot where I can see x and y >=2012 and <2012.
I have tied
plot(data$y[year>='2012'], x[year>='2012']) That did not work.
also plot(data$y, data$x, year>'2012') did not give the right data plot
Any suggestions on how to do this would be appreciated.
thanks
More information about the R-help
mailing list