[R] Subset a data frame for plotting
Paul Warren Simonin
Paul.Simonin at uvm.edu
Fri Apr 10 02:58:39 CEST 2009
Hello,
I have a question regarding how to subset/select parts of a data
frame (matrix) in order to plot data associated only with this subset.
Specifically I have a large data frame in which one column contains ID
values (dates), and other columns contain data I would like to plot
(temperature, light, etc.). I would like to break up this large matrix
so as to plot data associated with specific ID values (dates)
separately. I have learned of several commands that supposedly subset
matrices in this manner and have tried the following code with no
success:
200706183<-subset(AllData, ID = 200706183)
200706183<-gx.subset(AllData, ID == 200706183)
200706183<-subset(x=AllData, AllData$ID = 200706183)
200706183<-gx.subset(x=AllData, AllData$ID == 200706183)
In using this code my plan was to create smaller data frame objects
which I could then plot. My first question, though, is whether this is
the correct approach. Is there a more efficient way I can create plots
conditional on certain criteria such as "code = 200706183" ?
If I do need to first create separate smaller data frames, how do I
go about doing this? Am I missing something in the above commands?
Any other advice is certainly welcome too, as I admit to being a
bit new to R. Thank you very much for any answers, tips, suggestions,
etc.!
Best wishes,
Paul Simonin
--
Paul W. Simonin
Graduate Research Assistant, MS Program
Vermont Cooperative Fish and Wildlife Research Unit
The Rubenstein School of Environment and Natural Resources
University of Vermont
81 Carrigan Dr.
Burlington, VT 05405
Ph:802-656-3153
More information about the R-help
mailing list