ud.set.encoding: Set the udunits package level encoding type

Description Usage Arguments Details Value Author(s) References Examples

View source: R/ud.functions.R

Description

This function sets the encoding type parameter which is global to the R udunits2 package.

Usage

1
ud.set.encoding(enc.string)

Arguments

enc.string

A character string representing the encoding type. Valid strings are utf8,ascii,iso-8859-1,and latin1 (an alias for ISO-8859-1).

Details

Encoding type is a parameter to nearly all of the functions in the udunits library. By default, the R udunits2 pacakge sets the encoding type to UTF-8, however this package allows the user to set other encoding types which are supported by the udunits library. It presently suports UTF-8, ASCII, and ISO-8859-1

Value

Returns no value. Raises an error if it is not given a valid encoding string.

Author(s)

James Hiebert hiebert@uvic.ca

References

Unidata's udunits reference: https://www.unidata.ucar.edu/software/udunits/ API guide chapter on data types: https://www.unidata.ucar.edu/software/udunits/udunits-2.1.24/udunits2lib.html#Types

Examples

1
2
3
valid.enc.strings <- c('utf8', 'ascii', 'iso-8859-1', 'latin1')
lapply(valid.enc.strings, ud.set.encoding)
err <- try(ud.set.encoding("This will fail"))

pacificclimate/Rudunits2 documentation built on Feb. 20, 2022, 4:25 p.m.