[R] processing subset lists and then plot(density())

stephen sefick ssefick at gmail.com
Tue Aug 26 15:51:25 CEST 2008


d <- structure(list(Site = structure(c(8L, 12L, 7L, 6L, 11L, 5L, 10L,
4L, 3L, 2L, 1L, 9L, 8L, 12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L,
1L, 9L, 8L, 12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L, 1L, 9L, 8L,
12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L, 1L, 9L, 8L, 12L, 7L, 6L,
11L, 5L, 10L, 4L, 3L, 2L, 1L, 9L, 8L, 12L, 7L, 6L, 11L, 5L, 10L,
4L, 3L, 2L, 1L, 9L, 8L, 12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L,
1L, 9L, 8L, 12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L, 1L, 9L, 8L,
12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L, 1L, 9L, 8L, 12L, 7L, 6L,
11L, 5L, 10L, 4L, 3L, 2L, 1L, 9L, 8L, 12L, 7L, 6L, 11L, 5L, 10L,
4L, 3L, 2L, 1L, 9L, 8L, 12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L,
1L, 9L), .Label = c("119", "148", "179", "185", "190", "198",
"202", "215", "61", "BC", "HC", "SC"), class = "factor"), EPT.Taxa = c(NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, 1L, NA, 3L, 1L, 5L, 7L, 3L, 11L, 3L, 14L, 12L, 12L,
0L, 0L, 4L, 0L, 5L, 3L, 2L, 6L, 1L, 8L, 6L, 9L, 1L, 0L, 2L, 0L,
5L, 2L, 1L, 0L, 2L, 4L, 6L, 8L, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 2L, 4L, 3L, 2L, 7L, 6L, 4L, 8L, 7L, 11L, 8L,
11L, 1L, 3L, 0L, 2L, 7L, 8L, 2L, 7L, 6L, 11L, 6L, 12L, 1L, 1L,
0L, 0L, 0L, 1L, 2L, 9L, 6L, 16L, 6L, 10L, 2L, 3L, 3L, 2L, 5L,
2L, 0L, 3L, 6L, 10L, NA, 10L, 1L, 0L, 3L, 1L, 4L, 2L, 3L, 2L,
3L, 11L, 10L, 6L)), .Names = c("Site", "EPT.Taxa"), class =
"data.frame", row.names = c(NA,
-144L))
subset(d, Site==215)
#I would like to plot(density()) of each of the Sites
#I tried
list<-levels(d$Site)
lapply(d, FUN=subset, Site==list)
#I would like to be able to make a list of the subsets based on Site
and then plot them all on one graphics window
# Am I working in the right direction- I have just discovered lists (I
know I know, I am a little slow)
-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

	-K. Mullis



More information about the R-help mailing list