format - using scientific notation in R -
i'm using printcoefmat print matrix out , want apply formatting numbers.
i want force scientific notation when numbers have exponent greater 3. can't quite figure out how scipen works, have idea how can this?
just type in big number r display unscientific notation.
options( scipen = 20 ) if that's not enough, make number bigger...
how scipen penalty work?
it confusing, penalty applied scientific notation version, in r looks @ how many characters takes print particular string. adds value scipen penalty number of characters in scientific notation , if still less number of characters required print actual number print scientific , vice versa. hope example illustrate point:
options( scipen = 0 ) options( digits = 6 ) >1e5 #[1] 1e+05 ----> 5 characters in scientific, vs. 6 '100000' in normal >1e4 #[1] 10000 ----> 5 characters in normal, vs. 5 '1e+04' in scientific options(scipen = 1 ) >1e5 #[1] 100000 ----> 6 characters in normal, vs. 5 + 1 '1e+05' + scipen penalty in scientific
Comments
Post a Comment