R中的风频

时间:2015-02-27 01:05:00

标签: r

我使用了R的circular包以及openair来绘制风玫瑰。我无法做的是显示我想要使用的箱子范围(如下所示)中的风的频率。如何使用这些包确定频率(百分比和相对值)?我想打印这些或实际使用它创建直方图。 箱子如下所示

N, NNE, NE ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW

require(openair)
require(circular)
df<- read.csv("Direction.csv", header = TRUE)
df1<-df[c(-1,-2,-3,-4,-5,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-20)]
dput(head(df2))
structure(list(X850mb = structure(c(355, 349, 350, 65, 36, 56, 
197, 282, 162, 219, 353, 32, 6, 14, 195, 45, 8, 182, 285, 285, 
260, 315, 341, 343, 321, 10, 49, 61, 49, 159, 170, 49, 64, 98, 
137, 178, 279, 173, 223, 221, 283, 246, 227, 231, 301, 212, 259, 
329, 293, 229, 205, 261, 354, 349, 254, 311, 47, 176, 195, 224, 
253, 293, 21, 34, 98, 225, 187, 204, 276, 280, 277, 233, 204, 
233, 218, 212, 279, 320, 334, 205, 288, 15, 325, 322, 356, 308, 
0, 343, 349, 10, 301, 340, 346, 281, 218, 305, 344, 304, 254, 
275, 246, 306, 271, 309, 191, 197, 296, 312, 224, 265, 336, 2, 
356, 336, 340, 349, 351, 11, 15, 306, 270, 249, 257, 271, 303, 
328, 358, 52, 241, 298, 309, 259, 285, 268, 313, 339, 359, 314, 
348, 309, 302, 322, 315, 285, 327, 327, 306, 29, 105, 111, 316, 
1, 25, 332, 352, 270, 275, 238, 308, 338, 343, 349, 339, 346, 
352, 24, 17, 5, 8, 9, 346, 318, 338, 22, 18, 337, 280, 274, 301, 
302, 286, 6, 43, 35, 6, 26, 356, 4, 356, 325, 336, 20, 345, 354, 
18, 54, 358, 313, 12, 327, 317, 329, 339, 274, 157, 143, 190, 
306, 327, 332, 359, 49, 14, 323, 328, 331, 1, 306, 339, 21, 33), circularp = structure(list(type = "angles", units = "degrees", 
    template = "geographics", modulo = "2pi", zero = 1.5707963267949, 
    rotation = "clock"), .Names = c("type", "units", "template", 
"modulo", "zero", "rotation")), class = c("circular", "integer"
))), .Names = "X850mb")
rose.diag(df2, bins = 16, main = '30yrs', col= 'darkgrey', prop = 2.0)

1 个答案:

答案 0 :(得分:1)

我怀疑这样的事情就是你所追求的:

x <- cut(((as.vector(df2$X850)) +  360/(16*2) )%% 360,
    seq(0,360,360/16) ,
    c('N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW'))
table(x)