On Mon, 24 Oct 2011, B77S wrote:
The following might not be exactly the way to do this, but see the package "reshape" and the line of code following your data:
Thank you, B77S. Bert pointed me to reshape and reshape2. I'll read the help pages for them before responding. I'll be out of the office all tomorrow morning so it will be after lunch (PST) that I get back to this.
df <- structure(list(site = structure(c(1L, 1L, 2L, 4L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("BC-0.5", "BC-2", "BC-3", "BC-4"), class = "factor"), sampdate = structure(c(11L, 11L, 5L, 12L, 7L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 8L), .Label = c("1994-01-20", "1994-02-17", "1994-03-24", "1994-06-13", "1994-07-25", "1994-08-18", "1994-10-19", "1994-10-20", "1995-03-16", "1995-06-21", "1996-06-02", "1996-08-23"), class = "factor"), param = structure(c(2L, 3L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Cond", "SO4", "TDS"), class = "factor"), quant = c(194, 530, 826, 36, 848, 1795, 640, 406, 401, 441, 400, 393, 420, 438)), .Names = c("site", "sampdate", "param", "quant"), class = "data.frame", row.names = c("82", "83", "6903", "6905", "6977", "6980", "6983", "7833", "7838", "7847", "7854", "7866", "7871", "7877"))
The sample helps. My base data frame has 47045 rows, 148 sites, 66 parameters, and 1056 distinct sample dates. I'm going to study reshape/reshape2 thoroughly as I don't want to enter all those data by hand. :-) Regards, Rich ______________________________________________ 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.