Dear all,

Given a number

x<-1.234e12

is there a built-in function for extracting 1.234 and 12 ?

The following "hack" seems clumpsy:

> a<-strsplit(format(x, scientific=T),"e")[[1]]
> a
[1] "1.234" "+12"  
> as.numeric(a[1])
[1] 1.234
> as.integer(a[2])
[1] 12

Regards
Søren

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to