Q:

Convert a numeric vector to scientific format without changing the mode in R

I would like to convert a numeric vector into the scientific format without changing its mode to a character. The solutions here and here changes the mode to character. I have tried the following:
x <- c(1.0004, 2.2223,4, 509703045845, 0.0002)
mode(x)
#first attempt
x1 <- formatC(x, format = "e")
mode(x1)
as.numeric(x1)

#second attempt
x2 <- format(x, scientific = TRUE)
mode(x2)
as.numeric(x2)

Conversion to numeric does not retain the scientific display. I would like a solution that changes the display to scientific but retains numeric mode.

A:

Format and FormatC are designed to obtain characters in the desired shape. Your display of numerics will not be affected. Moreover, converting to character there and back to numerics will bias your numbers! Consider the first of your linked solutions using options()$scipen, which is literally the only option to change the display of numbers to R. scipen comes from scientific and penalty, see ?options.
x <- c(1.0004, 2.2223,4, 509703045845, 0.0002)

getOption("scipen")  ## displays defaults
# [1] 5
x
# [1] 1.00040e+00 2.22230e+00 4.00000e+00 5.09703e+11 2.00000e-04
as.numeric(format(x, scientific = TRUE))  ## convert there and back
# [1] 1.00040e+00 2.22230e+00 4.00000e+00 5.09703e+11 2.00000e-04

Both the same (?). 
But:
os <- options(scipen=50)  ## set scipen and store old scipen
x
# [1]         1.0004          2.2223       4.0000     509703045845.0000    0.0002
as.numeric(format(x, scientific = TRUE))  ## convert there and back
# [1]         1.0004          2.2223       4.0000     509703045845.0000    0.0002

So actually nothing happens, converting there and back is 1. a false solution,
options(os)  ## restore old scipen

and 2. will bias your numbers as shown below:
all.equal(x, as.numeric(format(x, scientific = TRUE)))
# [1] "Mean relative difference: 0.00000008994453"

Note: options are reset to the default values stored in your Rprofile.site when you restart R, so don't panic ;-)

