using cut for cyclic data
i am trying to analyse wind data using the 'cut开发者_如何学编程' command,
i want to set 16 wind directions how can i cut directions 348.75 till 11.25 to a "0" label? thank you eliavprobably this is not a general one and ad-hoc solution, but you can do it 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
There's a nice circular
package to help you work with directional data.
精彩评论