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

View source: R/cardinal_direction_to_degrees.R

cardinal_direction_to_degreesR Documentation

Function to transform cardinal direction wind directions to decimal degrees.

Description

Function to transform cardinal direction wind directions to decimal degrees.

Usage

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

 

# 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 Dec. 8, 2022, 3:52 a.m.