Re: [R] cumulative data monthly

2019-01-28 Thread Rui Barradas
Hello, Please click to keep this threaded. What I was trying to say is to do something along the lines of Y <- lubridate::year(dati$DATAORA) Y2013 <- Y[Y == 2013] PY2013 <- ave(dati$PREC, Y2013, FUN = cumsum) plot(dati$DATAORA, PY2013) Hope this helps, Rui Barradas Às 08:57 de 28/01/2019,

Re: [R] cumulative data monthly

2019-01-28 Thread Rui Barradas
Hello, With on«bjects of class "Date" or "POSIXt", POSIXct" you can do lubridate::year(date_obj) to extract the year. Then aggregate by it. Hope this helps, Rui Barradas Às 08:25 de 28/01/2019, Diego Avesani escreveu: Dear Jeff, Dear Rui, Dear all, Forget about the monthly things. I was tr

Re: [R] cumulative data monthly

2019-01-28 Thread Diego Avesani
Dear Jeff, Dear Rui, Dear all, Forget about the monthly things. I was trying to do two things at the same time. I try to explain myself. Thanks for your time and I really appreciate your help. I have a long file with hourly precipitation from 2000 to 2018. I would like to select only on e year o

Re: [R] cumulative data monthly

2019-01-27 Thread Jeff Newmiller
I have no idea what you mean when you say "select starting date and ending date properly form [sic] datai$DATA". For one thing there is no column called DATA, and for another I don't know what starting dates and ending dates you might be interested in. If you need help to subset by time, perhap

Re: [R] cumulative data monthly

2019-01-27 Thread Diego Avesani
Dear Jeff, Dear Rui, Dear all, I will try Rui's solution as soon as possible. If I could ask: As a first step, I would like to follow Jeff's suggestion. I will represent the precipitation data with a cumulative distribution, one for each year. This follow that I would like to select the starting

Re: [R] cumulative data monthly

2019-01-27 Thread Jeff Newmiller
Very succinct, Rui! One warning to Diego automatic data recorders tend to use the local standard timezone year-round. R by default assumes that timestamps converted from character to POSIXct using the current timezone on your computer... which may not be in the same zone that the logger was

Re: [R] cumulative data monthly

2019-01-27 Thread Rui Barradas
Hello, See if the following can get you started. It uses package CRAN zoo, function as.yearmon. dati$MES <- zoo::as.yearmon(dati$DATAORA) PMES <- ave(dati$PREC, dati$MES, FUN = cumsum) plot(dati$DATAORA, PMES) Hope this helps, Rui Barradas Às 15:25 de 27/01/2019, Diego Avesani escreveu: De

Re: [R] cumulative data monthly

2019-01-27 Thread Jeff Newmiller
Are you looking for a plot where each point represents a month? Or a plot where each point represents the accumulated precipitation so far that month? The latter seems closer to your computations so far, but doesn't seem like a typical way to present precipitation data... On January 27, 2019 7

[R] cumulative data monthly

2019-01-27 Thread Diego Avesani
Dear all, I have a set of data with has hourly value: # ID # Lo # L # Q Time,T, RH,PSFC,DIR,VEL10, PREC, RAD, CC,FOG -mm-dd hh:mm, °C, %, hPa, °N, m/s, mm/h,W/m², %,- 2012-01-01 06:00, -0.1,100, 815,313, 2.6, 0.0, 0, 0,0 2012-01-01 07:00, -1.2, 93, 814,314, 4.8, 0.0, 0, 0,0