Dear all, 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...
mean_wind<- aggregate(datos[range_of_dates,col_wind_speed], list(date=format(as.Date(datos[range_of_dates,col_dates],"%d/%m/%Y"),"%d/%m/%Y")), 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 Mar�a [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.