Converting a string to a number in R -


i'm having trouble writing function turns string representation of number decimal representation. boil issue down essentials, consider following function:

   f <- function(x) {       y <- as.numeric(x)       return(y)    } 

when apply function string "47.418" 47.42, want 47.418. seems return value being rounded reason.

any suggestions appreciated

you have done print options. no rounding:

> f <- function(x) { y <- as.numeric(x); return(y) } > f(47.418) [1] 47.418  ?options 

the default value digits 7:

> options("digits") $digits [1] 7 

further questions should accompanied dput() on object in question.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -