chr2nu: Internal function for quick class change of a vector to...

View source: R/InternalSimpleClass_function.R

chr2nuR Documentation

Internal function for quick class change of a vector to numeric

Description

This function takes a factor vector and changes it to a numeric. This is primarily to avoid instances where a csv file has been opened without column classes being specified, which can result in numeric values being accidently read as factors, which in turn when treated with as.numeric() will accidently be given integer values in the order of the factor levels. By treating the values as characters first it avoids this potential error.

Usage

chr2nu(X)

Arguments

x

is a vector to be converted to a numeric vector

Value

This function returns a numeric vector

Author(s)

Ardern Hulme-Beaman


ArdernHB/GeoOrigins documentation built on Nov. 19, 2022, 10:21 a.m.