Message-ID: <7E8037094A0C2146AA3E6F94DAE621C34454DE59@AD-EXCHMBX2-1.aau.dk>
Date: 2013-06-23T09:54:03Z
From: Søren Højsgaard
Subject: Built-in function for extracting mantissa and exponent of a numeric
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