Yes, as far as I can tell, "sampling.date" is a character vector of the format "1/15/2008". It resides in the leftmost column of the tapply output.
"station.code" are the A, B, C column headers which refer actual water quality station locations, and the values below those headers correspond to the "sampling.date" when samples were taken. Actually what I have done is to take the mid-point of each month and calculated its mean to deal with multiple samples taken in one month, and to generate NAs where no sample was taken by purposefully not adding the na.rm=T to the tapply command. Normally I would do this: > rdate<-as.POSIXct(strptime(date,format="%m/%d/%Y")) #convert sampling.date to > date R can handle > plot(A~rdate) If I just submit station.code like > A I get all the values for "Station A". It is in converting the sampling.date to an "rdate" that has me stumped. One reason being that in the tapply output the character vector representing date has no column name. I can't access that column. Gregory A. Graves, Lead Scientist Everglades REstoration COoordination and VERification (RECOVER) Wetland Watershed Sciences / Restoration Sciences Department South Florida Water Management District Phones: DESK: 561 / 682 - 2429 CELL: 561 / 719 - 8157 -----Original Message----- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Thursday, February 03, 2011 12:50 PM To: Graves, Gregory Cc: r-help@r-project.org; Goodman, Patricia; Gorman, Patricia Subject: Re: [R] tapply output as a dataframe On Feb 3, 2011, at 11:29 AM, Graves, Gregory wrote: > My tapply output is generated as follows: > >> a=tapply(value,list(sampling.date,station.code),mean) Why not give us sampling.date (which is probably NOT really a date but rather a character vector) and station.code so we can show you how to create a more appropriate structure? > > which gives me this (in part): > > A B C D E F G H I > J K > 1/15/2008 0.004 0.027 0.019 0.015 0.035 0.022 0.007 0.038 0.042 > 0.045 0.0350 > 1/15/2009 0.027 0.027 0.031 0.015 0.008 0.021 0.007 0.027 0.026 > 0.029 0.0210 > 1/15/2010 0.016 0.020 0.015 0.022 0.015 0.013 0.007 0.014 0.019 > 0.019 0.0180 > 10/15/2007 0.052 0.051 0.032 0.024 0.017 0.044 0.015 0.058 0.063 > 0.061 0.0640 > 10/15/2008 0.042 0.054 0.030 0.017 0.024 0.030 0.019 0.044 0.047 > 0.051 0.0390 > 10/15/2009 0.047 0.035 0.031 0.020 0.012 0.039 0.019 0.051 0.055 > 0.054 0.0350 > The only way I can figure out how to resolve this, such that I can, > for example, plot station "A" against date, is to export the tapply > output as a csv, and then reimport. > > Suggestions? I couldn't find a solution to this likely SIMPLE problem Perhaps. but we haven't really been told what the problem is, have we? > in Crawley or multiple searches of R help. > > Gregory A. Graves, Lead Scientist David Winsemius, MD West Hartford, CT ______________________________________________ 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.