Error Creating a WindRose

I am trying to create a simple windrose which I have done many times, however recently I have encountered a problem when using the same code I have always used. Please see below the code I am using to create a wind rose:

require(openair)
setwd ("C:/Users/jaimistry/Desktop/Misc")
data <- import("MB Yi_Windrose.csv")
png(filename = "Yi_Windrose.png", width = 650, height = 650, units = "px", res = 80, restoreConsole = TRUE)
windRose(data, paddle = "FALSE", angle = 22.5, breaks = c(0,5,10,15,20))
dev.off()

I am getting the below error which have never been outputted before.

Error in import("MB Yi_Windrose.csv") : could not find function "import"

Any help would be much appreciated.

Jai

It looks like you are having problems at the data<-import("MBYi_Windrose.csv") line. It seems like the error that about not being able to find the function for import is because you don't have the correct library loaded for that function. I have only used the read.csv function for .csv files, but if you need to use the import() function, try installing the library associated with that function.

Is import() part of rio? If it is, documentation for rio here, instructs how you can install the package and then use library("rio") so you can use import()

Hi RMiller,

Thanks, installing Rio worked and I can now use import, however when running the second part of the code to output the WindRose:
png(filename = "Yi_Windrose.png", width = 650, height = 650, units = "px", res = 80, restoreConsole = TRUE)
windRose(data, paddle = "FALSE", angle = 22.5, breaks = c(0,5,10,15,20))
dev.off()

I am getting the below error, as mentioned previously I have used this code multiple times and not encountered this error, any help would be much appreciated, the error:

Error in format.default(min(x$date), "%d %B %Y") : **
** invalid 'trim' argument

Kind Regards,
Jai

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.