The purpose of this class is to represent data that is essentially
numeric, but also included some ‘special’ values that are
non-numeric and hence the object cannot
cannot be represented by a standard
class. A typical example would be an assay result
that used a symbol like
"BQL<(1.00)" to represent
1 2 3 4 5 6 7 8 9 10 11
A vector containing mixed data (typically
An object of class
A value to use when no other value is appropriate. See details.
Additional arguments to be passed to or from methods.
The class implements just a few methods. The main uses are:
as.numeric to avoid the warning issued when calling
this method on type
character and the danger of calling it on
factor (see Examples).
unique, which considers all numeric values as
"<Number>" and hence allows one to quickly identify all
the ‘special’ (non-numeric) values are.
quote = FALSE for readability.
mixedData returns a new object of class
The methods return what one would expect:
Ben Rich <email@example.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# Generate a vector with approx. 5% left-censoring: set.seed(123) x <- rexp(350, 0.05129329) x <- ifelse(x < 10, "BQL<(1.00)", as.character(signif(x, 4))) # Another 'special' result, 'quantity not sufficient': x <- "QNS" x <- factor(x) unique(x) # Not very useful # Warning! not the desired result when x is a factor: as.numeric(x) # This works, but you get a warning: as.numeric(as.character(x)) y <- mixedData(x) unique(y) print(y) as.numeric(y) as.character(y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.