csrc2010
2009-Mar-18 04:31 UTC
[R] separating the integer part of a number from the fractional part
I have columns of decimal numbers (representing fraction day of year). I need to separate the fractional part of the number (to the right of the radix point) from the integer part. For example, if the number were '207.65' Id like to make a separate column which contained only '65' or even better, '0.65.' What I am trying to do is separate day from night. Any ideas?? Thanks. -JPG -- View this message in context: http://www.nabble.com/separating-the-integer-part-of-a-number-from-the-fractional-part-tp22572715p22572715.html Sent from the R help mailing list archive at Nabble.com.
Peter Dalgaard
2009-Mar-18 08:48 UTC
[R] separating the integer part of a number from the fractional part
csrc2010 wrote:> I have columns of decimal numbers (representing fraction day of year). I need > to separate the fractional part of the number (to the right of the radix > point) from the integer part. For example, if the number were '207.65' Id > like to make a separate column which contained only '65' or even better, > '0.65.' What I am trying to do is separate day from night. Any ideas?? > Thanks. > -JPG> 207.65 %%1[1] 0.65> 207.65 - trunc(207.65)[1] 0.65> 207.65 - floor(207.65)[1] 0.65 Notice differences for negative numbers though:> -207.65 %%1[1] 0.35> -207.65 - trunc(-207.65)[1] -0.65> -207.65 - floor(-207.65)[1] 0.35 -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
Maybe Matching Threads
- choose incorrect for fractional and some negative integer values (PR#10766)
- [Bug 13222] New: rsync creates warning if time of destination file differs in fractional part of second and owner mismatches
- [LLVMdev] [Sparc] size of input arguments with doubles in llvm byte code?
- [LLVMdev] [Sparc] size of input arguments with doubles in llvm byte code?
- [PATCH v17 2/6] radix tree test suite: add tests for xbitmap