Create or test for objects of type "character".
character(length = 0)
as.character(x, …)
is.character(x)
| Parameter | Description |
|---|---|
length |
A non-negative integer specifying the desired length. Double values will be coerced to integer: supplying an argument of length other than one is an error. |
x |
object to be coerced or tested. |
… |
further arguments passed to or from other methods. |
# NOT RUN {
form <- y ~ a + b + c
as.character(form) ## length 3
deparse(form) ## like the input
a0 <- 11/999 # has a repeating decimal representation
(a1 <- as.character(a0))
format(a0, digits = 16) # shows one more digit
a2 <- as.numeric(a1)
a2 - a0 # normally around -1e-17
as.character(a2) # normally different from a1
print(c(a0, a2), digits = 16)
# }