[R] taking daily modes from hourly data
b_u_l_m_a at hotmail.com
Tue Sep 23 15:40:22 CEST 2014
I have a data frame (datos) of hourly wind speed and direction with 4columns (1st date, 2nd hour, 3rd wind speed and 4rth wind direction). I have been able to do the daily mean of the wind speed, but when I try to get the more frequent wind direction of every day, it doesn't work. I have tried to do it with aggregate function, but it only works for mean, max, min...
FUN=mean, na.rm=TRUE) #it works perfectly
mode_wind<- aggregate(datos[range_of_dates,col_wind_direction], list(date=format(as.Date(datos[range_of_dates,col_dates],"%d/%m/%Y"),"%d/%m/%Y")), FUN=mode) #it tells me "numeric"
Can anyone help me? My data have not the same length for each day, I mean, for example it is possible that for 1st of January I have 20 hours of data, but for the 2nd of January I have 24, or the 3rd of January I have 18...so I need to aggregate the data to calculate the mean and the mode from the column of my date...
Thanks in advance
[[alternative HTML version deleted]]
More information about the R-help