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.dalga...@biostat.ku.dk) FAX: (+45) 35327907 ______________________________________________ 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.