ud.set.encoding {udunits2}R Documentation

Set the udunits package level encoding type

Description

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

Usage

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

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"))

[Package udunits2 version 0.13.2.1 Index]