So basically my data is the following: Data point #, Date, Time, Temp and Salinity. Loggers logged over 9 months, and I need to summarize each day by minimum temperature and salinity, as well as max, range, and mean. The number of data points are not consistent each day, because some data needed to be pulled out because the loggers became exposed in the intertidal. Any suggestions on code for this? Very new to R, but would like to use it as much as possible.

#   Date    Time    Temp°C  Salinity,ppt   
8   5/12/13 9:52    15.13   28.2187  
9   5/12/13 10:02   15.21   28.0135  
10  5/12/13 10:12   15.38   27.7348  
11  5/12/13 10:22   15.51   27.5082  

closed as off-topic by gung, mpiktas, Scortchi, Nick Cox, Peter Flom Jan 15 '14 at 10:56

  • This question does not appear to be about statistics within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Try search for ?aggregate or ?tapply in R. Also, because this question is not about statistics but rather how to manipulate a software, it may be moved to Stack Overflow. $\endgroup$ – Penguin_Knight Jan 15 '14 at 4:07
  • 1
    $\begingroup$ If you don't need statistical advice on how to exclude exposed logger data, this question is probably off-topic. Matters of coding within a particular software environment tend to get passed over to Stack Overflow when they don't require special statistical knowledge. $\endgroup$ – Nick Stauner Jan 15 '14 at 4:08
  • $\begingroup$ This is also not especially suitable for SO, as it is a case of "please give me code". SO is focused on problems with posters' code; it is not a help line for people who need code. $\endgroup$ – Nick Cox Jan 15 '14 at 9:26
  • 1
    $\begingroup$ This question appears to be off-topic because it is focused on a code request. $\endgroup$ – Nick Cox Jan 15 '14 at 9:27

Aggregate() may be a suitable solution:

mySummary <- data.frame(
aggregate(Petal.Width~Species, data=iris, min),
aggregate(Petal.Width~Species, data=iris, max),
aggregate(Petal.Width~Species, data=iris, mean))

mySummary <- mySummary[,c(1,2,4,6)]

colnames(mySummary) <- c("species", "min", "max", "mean")



     species min max  mean
1     setosa 0.1 0.6 0.246
2 versicolor 1.0 1.8 1.326
3  virginica 1.4 2.5 2.026

Not the answer you're looking for? Browse other questions tagged or ask your own question.