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
Post a Comment