# NOT RUN {
x <- 1:5
names(x) <- c("a", "b", "c", "d", "e")
as.numbers(x) # vector converted from integer to double, names removed
x <- x + 0i # x is now a complex vector
as.numbers(x) # vector of type double since all numbers were purely real
## vector of type complex, despite being purely real
as.numbers(x, strict = FALSE)
x <- x + 1i
## vector remains of type complex since numbers are not purely real
as.numbers(x)
# }
Run the code above in your browser using DataLab