cardinal_direction_to_degrees: Function to transform cardinal direction wind directions to...

Description Usage Arguments Value Author(s) Examples

View source: R/cardinal_direction_to_degrees.R

Description

Function to transform cardinal direction wind directions to decimal degrees.

Usage

1
cardinal_direction_to_degrees(x, north_is = 360)

Arguments

x

Character vector with cardinal direction elements.

north_is

What decimal degree should north be transformed to? Can be either 360 or 0.

Value

Numeric vector.

Author(s)

Stuart K. Grange.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 

# Function uses uppercase and abbreviated cardinal directions
x <- c(
  "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", 
  "W", "WNW", "NW", "NNW"
)

# Transform to decimal degrees
cardinal_direction_to_degrees(x)

# Transform but use 0 degrees for north
cardinal_direction_to_degrees(x, north_is = 0)

skgrange/waclr documentation built on Sept. 11, 2019, 3:53 p.m.