Using a slice for cyclic data

I'm trying to analyze wind data using the “cut” command,
I want to set 16 wind directions,
how can I cut the directions 348.75 to 11.25 to the mark “0”? thank you Eliav

+3
source share
2 answers

This is probably not a general, but a special solution, but you can do this by adding 360/16/2 to the direction value:

w<- -15:375
direction<-cut((w+360/16/2)%%360,breaks=seq(0,360,length=17),labels=FALSE)-1
+2
source

There is a good circularpackage that will help you work with directional data.

+2
source

Source: https://habr.com/ru/post/1756404/


All Articles