[R] cumulative data monthly

Diego Avesani d|ego@@ve@@n| @end|ng |rom gm@||@com
Sun Jan 27 16:25:17 CET 2019


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
yyyy-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
2012-01-01 08:00,  1.7, 68, 815,308,  7.5,  0.0,  41, 11,0
2012-01-01 09:00,  2.4, 65, 815,308,  7.4,  0.0, 150, 33,0
.....
.....

I was able to read it,  create my-own data frame and to plot the total
cumulative function.
This is basically what I have done:

dati <- read.csv(file="116.txt", header=FALSE, sep="," ,
na.strings="-999",skip = 6)
colnames(dati)=c("DATAORA","T", "RH","PSFC","DIR","VEL10", "PREC", "RAD",
"CC","FOG")

dati$DATAORA<-as.POSIXct(strptime(dati$DATAORA,format="%Y-%m-%d %H:%M"))


P <- cumsum(dati$PREC)
plot(dati$DATAORA, P)

I would like to select the data according to an starting and ending date.
In addition, I would like to plot the monthly and not the total one.
I mean, I would like to have a cumulative plot for each month of the
selected year.

I am struggling with "ddply" but probably it is the wrong way.

Could someone help me?  Really Really thanks,


Diego

	[[alternative HTML version deleted]]



More information about the R-help mailing list