Re: [R] Subset for plot in R

2014-02-19 Thread Greg Snow
So are the names of the columns in the dataset x, y, and z? or are they area, concentration, and year? you seem to be mixing these together? If you provide a minimal reproducible example (provide some data with dput, or the commands to generate random data, or use a built in dataset) then it

Re: [R] Subset for plot in R

2014-02-17 Thread arun
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

Re: [R] Subset and plot

2010-02-03 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 03.02.2010 02:54:46: Let's look at your data frame: str(daily.sub1) 'data.frame': 9 obs. of 4 variables: $ Trial: Factor w/ 1 level 2: 1 1 1 1 1 1 1 1 1 $ Tanks: Factor w/ 3 levels a4,c4,h4: 1 1 1 2 2 2 3 3 3 $ Day : Factor w/ 9 levels

[R] Subset and plot

2010-02-02 Thread Marlin Keith Cox
Here is a runable program. When I plot Day and Wgt, it graphs all the data points. All I need is daily.sub1 plotted. I also need each Tanks to have its own col or pch. When I run it with the line with pch, it gives me nothing. rm(list=ls()) Trial-rep(c(1,2),each=12)

Re: [R] Subset and plot

2010-02-02 Thread Chuck Cleland
On 2/2/2010 2:51 PM, Marlin Keith Cox wrote: Here is a runable program. When I plot Day and Wgt, it graphs all the data points. All I need is daily.sub1 plotted. I also need each Tanks to have its own col or pch. When I run it with the line with pch, it gives me nothing. DF -

Re: [R] Subset and plot

2010-02-02 Thread Jeff Laake
The problem is with attach. You should have seen an error that the objects are aliased. You have Tanks in your workspace and in the attached dataframe. It is using the one in your workspace which is not a factor variable. Try: c(2,19,21)[Tanks] with(daily.sub1,c(2,19,21)[Tanks]) Avoid

Re: [R] Subset and plot

2010-02-02 Thread Marlin Keith Cox
I tried the following and still could not get it to work. I understand your logic, but cannot get this to work. rm(list=ls()) Trial-rep(c(1,2),each=12) Tanks=rep(c(a3,a4,c4,h4),each=3,2) Day=rep(c(1:12),2) Wgt=c(1:24) daily-cbind(Trial, Tanks, Day, Wgt) daily daily.sub-subset(daily,

Re: [R] Subset and plot

2010-02-02 Thread Rolf Turner
What did you ***expect*** or hope to get out of ``c(2,19,21)[Tanks]'' Please note that this expression makes no sense at all as it stands. You apparently want to use plotting symbols 2, 19, and 21 respectively, depending in some way upon the value in ``Tanks''. Since you have

Re: [R] Subset and plot

2010-02-02 Thread Marlin Keith Cox
Initial email: Here is a runable program. When I plot Day and Wgt, it graphs all the data points. All I need is daily.sub1 plotted. I also need each Tanks to have its own col or pch. When I run it with the line with pch, it gives me nothing. rm(list=ls()) Trial-rep(c(1,2),each=12)

Re: [R] Subset and plot

2010-02-02 Thread Dennis Murphy
Let's look at your data frame: str(daily.sub1) 'data.frame': 9 obs. of 4 variables: $ Trial: Factor w/ 1 level 2: 1 1 1 1 1 1 1 1 1 $ Tanks: Factor w/ 3 levels a4,c4,h4: 1 1 1 2 2 2 3 3 3 $ Day : Factor w/ 9 levels 10,11,12,..: 4 5 6 7 8 9 1 2 3 $ Wgt : Factor w/ 9 levels 16,17,18,..: 1

Re: [R] Subset and plot

2010-02-02 Thread Jeff Laake
Don't need to convert the factors to numeric as that will happen automatically. See below. However as Rolf pointed out they will be numbered from 1-4 even though only 3 are left in the subset as all 4 levels are maintained. So the snippet below will work as long as you specify 4 possible

[R] subset and plot

2008-04-21 Thread Marlin Keith Cox
create a subset for brook_dis. When I plot (week, R) I get a nice boxplot, but along the x axis, there are weeks a, b, c along with h and nh. Thank you ahead of time. keith rm(list=ls()) cond.exp1-read.csv(condition/test.csv,header=TRUE) sub-subset(cond.exp1, Species==brook_dis)