[R] convert wind direction from degrees to basic compass directions

David Winsemius dwinsemius at comcast.net
Sat Oct 23 22:59:51 CEST 2010


On Oct 23, 2010, at 1:40 PM, will phillips wrote:

>
> Hello,
>
> I have a data set that includes a predictor variable "wind  
> direction".  This
> variable is in degrees with 0=North.  I've put this predictor into a  
> linear
> model and its coefficient is far from significant.
>
> I was thinking about converting this variable into 8 factors "north"
> "northwest" "west" and on around to see if that helps.
>
> If I add 360 to every entry I know that anything from 337.5 to 382.5  
> would
> be "north", anything from 382.51 to 427.5 would be "northwest", etc...
>
> I'm fairly new to R and I can assign labels to values in a vector  
> but I
> can't seem to figure out how to assign a label to a value if it falls
> between a sequence of numbers.
>
> If anyone has input for me I would be very grateful.

The "circular" package has data structures and regression methods  
appropriate to this situation.

-- 
David.
>
> Thank you
>
> Will
>
>
>
>
>
>
> -- 
> View this message in context: http://r.789695.n4.nabble.com/convert-wind-direction-from-degrees-to-basic-compass-directions-tp3008773p3008773.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list