I have hourly values for precipitation that I'd like to sum up over the hour.
My data (Nd_hourly) looks like this:
Datum Uhrzeit Nd
1 2013-05-01 01:00:00 0.0
2 2013-05-01 02:00:00 0.1
3 2013-05-01 03:00:00 0.0
4 2013-05-01 04:00:00 0.3
(date,time, precipitation)
and I'd like to have an output of Datum - Nd
I did the min and max temperatur with the package plyr and the function ddply with
t_maxmin=ddply(t_air,.(Datum),summarize,Datum=Datum[which.max(T_Luft)],max.value=max(T_Luft),min.value=min(T_Luft))
I then tried to do something similar for the precipitation and tried
Nd_daily=ddply(Nd_hourly,.(Datum),summarize,Datum=Datum, sum(Nd_hourly))
but get the error message
Error: only defined on a data frame with all numeric variables
I assume something may be wrong with my data input? I imported data from Excel 2010 via a .txt file.
Still very new to R and programming in general, so I would really appreciate some help :)