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

will phillips will.phillips at q.com
Sat Oct 23 22:40:13 CEST 2010


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.

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.



More information about the R-help mailing list