Dear Sherri,
If your data set is called "mydata", you can separate it by
"Levels" with
something like
# Separating the data by Level -- new.data is a list
new.data=split(mydata,mydata[,2])
new.data
# or
level1 = mydata[mydata$Level==1,]
level2 = mydata[mydata$Level==2,]
Now, if you want to plot the data, you can try this:
# (1) No previous separation
plot(mydata$Hour,mydata$C2,col=mydata$Level,type='l')
# (2) Using the separation
plot(level1$Hour, level1$C2,ylim=range(mydata$C2),col=1)
points(level2$Hour, level2$C2,ylim=range(mydata$C2),col=2)
With either (1) or (2) the graphic result is the same.
HTH,
Jorge
On Sun, Oct 12, 2008 at 11:44 PM, Sherri Heck <sheck@ucar.edu> wrote:
> Hi everyone-
>
> I have a dataset that I created using the aggregate command:
>
> Hour Level C2
> 1 1 1 -3.517117e+00
> 2 2 1 -2.536083e+00
> 3 3 1 -1.429000e+00
> 4 4 1 -1.148667e-01
> 5 5 1 1.345333e+00
> 6 6 1 3.108117e+00
> 7 7 1 4.763733e+00
> 8 8 1 6.161867e+00
> 9 9 1 7.374667e+00
> 10 10 1 8.470500e+00
> 11 11 1 8.585400e+00
> 12 12 1 7.919983e+00
> 13 13 1 6.047667e+00
> 14 14 1 2.248483e+00
> 15 15 1 -1.791750e+00
> 16 16 1 -4.711133e+00
> 17 17 1 -5.428500e+00
> 18 18 1 -5.165783e+00
> 19 19 1 -5.314700e+00
> 20 20 1 -5.579200e+00
> 21 21 1 -5.579433e+00
> 22 22 1 -5.384683e+00
> 23 23 1 -5.003400e+00
> 24 24 1 -4.470133e+00
> 25 1 2 -1.888567e+00
> 26 2 2 -1.394150e+00
> 27 3 2 -8.934167e-01
> 28 4 2 -3.589167e-01
> 29 5 2 2.093667e-01
> 30 6 2 8.582667e-01
> 31 7 2 1.544633e+00
> 32 8 2 2.203933e+00
> 33 9 2 2.819583e+00
> 34 10 2 3.388400e+00
> 35 11 2 3.776533e+00
> 36 12 2 3.951400e+00
> 37 13 2 3.753883e+00
> 38 14 2 2.852067e+00
> 39 15 2 1.418200e+00
> 40 16 2 -2.007833e-01
> 41 17 2 -1.471800e+00
> 42 18 2 -2.351217e+00
> 43 19 2 -3.034233e+00
> 44 20 2 -3.313900e+00
> 45 21 2 -3.331433e+00
> 46 22 2 -3.172550e+00
> 47 23 2 -2.881167e+00
> 48 24 2 -2.484167e+00
>
>
> and I would like to separate the dataset further so that I can plot Hour
> vs. C2 for Level = 1 and also Hour vs. C2 for Level = 1 on the same plot.
> I've been trying to use the "aggregate" command, but not
sure what function
> I should use. I'm not even sure if this is the best method. Any
> suggestions/pointers will be most appreciated-
>
> thanks-
>
> s.heck
>
> ______________________________________________
> R-help@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.
>
[[alternative HTML version deleted]]