Search code examples
ropenair

windrose error: Error in Summary.factor ‘min’ not meaningful for factors


I am using windRose in openair package in R (3.2.1), using R studio.

library(openair)
mydata = read.csv("sample.csv")
windRose(mydata)

Whether I use my own data (sample.csv):

date,ws,wd
14/10/2014 09:00,1.4,357
14/10/2014 10:00,1.5,49
14/10/2014 11:00,0.1,274
14/10/2014 12:00,0.3,77
14/10/2014 13:00,1,38
14/10/2014 14:00,1,351
14/10/2014 15:00,1,59
14/10/2014 16:00,1.4,23
14/10/2014 17:00,1,47
14/10/2014 18:00,0.9,3
14/10/2014 19:00,1.3,3
14/10/2014 20:00,2.3,146
14/10/2014 21:00,2.5,151
14/10/2014 22:00,1.5,176
14/10/2014 23:00,2.7,163
15/10/2014 00:00,2.4,174
15/10/2014 01:00,2.5,157
15/10/2014 02:00,2.8,152
15/10/2014 03:00,4.7,155
15/10/2014 04:00,3.4,164
15/10/2014 05:00,3.4,158
15/10/2014 06:00,3.9,153
15/10/2014 07:00,3.6,148
15/10/2014 08:00,3.2,147
15/10/2014 09:00,3.2,141
15/10/2014 10:00,3.7,136
15/10/2014 11:00,2.9,130
15/10/2014 12:00,3.6,123

or the sample data from the openair website, I get the same error:

Error in Summary.factor(1:28, na.rm = FALSE) : 
‘min’ not meaningful for factors

I have uninstalled and re-installed the packages: openair, png, dplyr, maps, lazyeval, using, for example:

remove.packages("dplyr")
install.packages("dplyr", dependencies = TRUE)

I have changed the date format in 'sample.csv', from YYYY/MM/DD to as shown, I have filled in any missing entries in 'sample.csv' I have made sure there are no zeros

This is the first thing I have attempted using openair

I am not sure what else to try here. Can you help? Thanks!


Solution

  • Use argument colClasses in read.csv to turn the first column into Date class:

    library(openair)
    
    mydata = read.csv("sample.csv", colClasses = c("Date", "numeric", "integer"))
    
    windRose(mydata)