-1

In openair package, windRose function linked wind direction between PM10 concentration. For example:

windRose(mydata, type = "pm10", layout = c(4, 1))

Wind rose for four different levels of PM10 concentration. The levels are defined as the four quantiles of PM10 concentration and the ranges are shown on each of the plot labels. Does anyone know how to control the PM10 concentration in those four figures ? For example, I want to make plots showing the PM10 concentration in "1 to 40", "40 to 75", "75 to 100" and "100 to 801"

Lee Yee
  • 17
  • 1
  • 8

1 Answers1

1

Use cut function and create a new column, you will use to plot:

mydata$pm10_breaks <- cut(mydata$pm10, c(1, 40, 75, 100, 801))
windRose(mydata, type = "pm10_breaks", layout = c(4, 1))

enter image description here

  • Hi Pascal,Thank you very much for your help. That is really help. Is there any way to include the maximum data in the break ? – Lee Yee Jan 13 '16 at 20:31
  • What do you mean? Breaks are `(1,40]`, `(40,75]`, `(75,100]` and `(100,801]`, as you asked for. –  Jan 13 '16 at 21:50
  • For example, for wind speed (ws), I just set `breaks = c(0, 2, 4, 6)` and the at the last bin the range of ws is between 6 and 20.16 which is maximum of ws. But for PM10, I have to set the last bin to make sure the maximum value of PM10 is less than 801. Thank you very much for your help. – Lee Yee Jan 13 '16 at 23:50
  • Sorry, I don;t understand. Please edit your question to clarify what you are looking for. –  Jan 14 '16 at 00:33
  • Sorry for bring the confusion. For example, if the maximum of PM10 is 900. By ruining the code above, the 900 will not be included in the figures. Is there any way we can set the last bin of plot from 801 to maximum ? – Lee Yee Jan 14 '16 at 00:40
  • Just change the last value in `cut`. Still don't see where is the problem. Or use something like `c(min(mydata$pm10), 40, 75, 100, max(mydata$pm10))`. –  Jan 14 '16 at 00:41
  • Hi Pascal, I have PM10 concentration at several sites with different maximum. I just want to find a way that the code can automatically reach the maximum at last bin. Otherwise, I have to reset the range of last bin for each site. Thank you very much. – Lee Yee Jan 14 '16 at 01:48
  • I am sorry for bring this confusion to you :( – Lee Yee Jan 14 '16 at 05:50