Learn R Programming

sos4R (version 0.4.2)

sosConvertString: SOS Conversion functions for Observation Results

Description

These functions are called by the parsers of om:Observation and om:Measurement documents to convert the actual values to the correct classes.

Usage

sosConvertString(x, sos)
sosConvertDouble(x, sos)
sosConvertTime(x, sos)
sosConvertLogical(x, sos)

Arguments

x

The object to be converted.

sos

An object of class SOS, whose settings, like formating information, can be utilized.

Value

An object of the respective class converted from the parameter x.

Details

The methods are automatically called from the given SOS's list of conversion functions. This is either default or can be set manually on creation.

If you want to provide you own conversion functions, follow the example below. Always include the common parameters x and sos.

There are functions to access the converters of a SOS (sosDataFieldConverters-methods) and to combine default and your own converters (SosDataFieldConvertingFunctions).

See Also

sosDataFieldConverters-methods, SosDataFieldConvertingFunctions

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
sos <- SOS_Test()
one <- sosConvertDouble("1", sos)
class(one)

# add conversion rules, also possible to override default ones
myConverters <- SosDataFieldConvertingFunctions(
	"C" = sosConvertDouble,
	"S/m" = sosConvertDouble)
sos <- SOS(url = SosExampleServices()[[2]], dataFieldConverters = myConverters)

# show converters
sosDataFieldConverters(sos)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab