简体   繁体   English

在R语言的openair包中使用windRose()函数时出错

[英]Getting error while using windRose() function from openair package in R language

I am trying to plot a wind rose diagram using openair package function windRose() in R language. 我正在尝试使用R语言的openair包装函数windRose()绘制风向图。 I have sample data for wind directions and wind speeds in a .csv file . 我在.csv文件中有风向和风速的示例数据。 The csv file data is also pasted to the post. csv文件数据也会粘贴到帖子中。

In RI have loaded the openair package and read the data from csv file to a dataframe data. 在RI中已加载了openair程序包,并将数据从csv文件读取为数据dataframe数据。 when I am calling the windRose() function as shown below I am getting an error. 当我如下图所示调用windRose()函数时,出现错误。

windRose(data,wd="dir",ws="spd")


Error in if (mean.wd < 0) mean.wd <- mean.wd + 360 : 
  missing value where TRUE/FALSE needed**

can some one please help me in finding the issue. 有人可以帮我找到问题吗?

sample csv file contents 样本csv文件内容

dir,spd
343,4.4
293,4.3
157,14.1
166,9.4
117,14.4
5,13.5
335,5.3
87,14.3
130,14.7
301,12.6
330,13.1
265,9.1
70,13.4
257,11.0
174,4.2
97,12.2

Renaming your columns, to ws and wd corrects the problem: 将列重命名为wswd可解决此问题:

dat <- read.table(text = 'wd,ws    ## I use wd and ws
343,4.4
293,4.3
157,14.1
166,9.4
117,14.4
5,13.5
335,5.3
87,14.3
130,14.7
301,12.6
330,13.1
265,9.1
70,13.4
257,11.0
174,4.2
97,12.2',header=T,sep = ',')

windRose(dat)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM