Re: [R] Correctly applying aggregate.ts()

2018-09-08 Thread Rich Shepard
On Sat, 8 Sep 2018, Rui Barradas wrote: Like Bert said, your data is a data.frame so there is no need to call aggregate.ts. Besides, R will call the right method so unless you want to change the standard behaviour, it would be enough to call aggregate and let the methods dispatch code to its j

Re: [R] Correctly applying aggregate.ts()

2018-09-08 Thread Rui Barradas
Hello, Like Bert said, your data is a data.frame so there is no need to call aggregate.ts. Besides, R will call the right method so unless you want to change the standard behaviour, it would be enough to call aggregate and let the methods dispatch code to its job. As for the problem, first a

Re: [R] Correctly applying aggregate.ts() [RESOLVED]

2018-09-07 Thread Rich Shepard
On Fri, 7 Sep 2018, Bert Gunter wrote: Well, let's see: "monthly.rain <- aggregate.ts(x = dp['sampdate','prcp'], by = list(month = \ substr(dp$sampdate, 1, 7)), FUN = sum, na.rm = TRUE)" 1. x is a data frame, so why are you using the time series method? Perhaps you need to study S3 method usage

Re: [R] Correctly applying aggregate.ts()

2018-09-07 Thread Bert Gunter
Clarification: When using the formula interface, no subscripting is needed. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Sep 7, 2018 at 3:25 PM Bert Gunt

Re: [R] Correctly applying aggregate.ts()

2018-09-07 Thread Bert Gunter
Well, let's see: "monthly.rain <- aggregate.ts(x = dp['sampdate','prcp'], by = list(month = \ substr(dp$sampdate, 1, 7)), FUN = sum, na.rm = TRUE)" 1. x is a data frame, so why are you using the time series method? Perhaps you need to study S3 method usage in R. 2. You have improperly subscripted

[R] Correctly applying aggregate.ts()

2018-09-07 Thread Rich Shepard
I've read ?aggregate and several blog posts on using aggregate() yet I still haven't applied it correctly to my dataframe. The sample data are: structure(list(sampdate = c("2005-01-01", "2005-01-02", "2005-01-03", "2005-01-04", "2005-01-05", "2005-01-06", "2005-01-07", "2005-01-08", "2005-01-