[R] Fwd: Dates Conversion/write.foreign

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Fri Nov 24 15:49:56 CET 2006


Correct me if I'm wrong, but a few weeks ago my professor from the
statistical computing class told us that SAS sometimes stores dates
including the time but only displays the date. So it looks like the time
isn't stored. This was the case with data imported from Excel. In our
exercise we had to explicitly define the date as a day, month and year.

So maybe you don't have a problem at all ;-)

Cheers,

Thierry

------------------------------------------------------------------------
----

ir. Thierry Onkelinx

Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature
and Forest

Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance

Gaverstraat 4

9500 Geraardsbergen

Belgium

tel. + 32 54/436 185

Thierry.Onkelinx op inbo.be

www.inbo.be 

 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt

A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney


-----Oorspronkelijk bericht-----
Van: r-help-bounces op stat.math.ethz.ch
[mailto:r-help-bounces op stat.math.ethz.ch] Namens Shubha Karanth
Verzonden: vrijdag 24 november 2006 15:32
Aan: r-help op stat.math.ethz.ch; saikat op stat.wisc.edu; Roger.Bivand op nhh.no
Onderwerp: [R] Fwd: Dates Conversion/write.foreign

---------- Forwarded message ----------
From: Shubha Vishwanath Karanth <shubhak op ambaresearch.com>
Date: Nov 24, 2006 7:54 PM
Subject: Dates Conversion/write.foreign
To: Shubha Karanth <shubhakaranth op gmail.com>, Shubha Vishwanath
Karanth <shubhak op ambaresearch.com>




Hi R experts,



I need an urgent help...



I have an a dataframe caled idat. Below i give a snapshot of it.



                                   Datetime                 Volume_a
    Volume_b



(11/21/06 12:50:00) (11/21/06 12:50:00)               0                0

(11/21/06 13:00:00) (11/21/06 13:00:00)               0                0

(11/21/06 13:10:00) (11/21/06 13:10:00)               0                0

(11/21/06 13:20:00) (11/21/06 13:20:00)               0                0

(11/21/06 13:30:00) (11/21/06 13:30:00)          342113             0

(11/21/06 13:40:00) (11/21/06 13:40:00)          695071             0

(11/21/06 13:50:00) (11/21/06 13:50:00)          470943          4690

(11/21/06 14:00:00) (11/21/06 14:00:00)          870072             0

(11/21/06 14:10:00) (11/21/06 14:10:00)         1010101          2000

(11/21/06 14:20:00) (11/21/06 14:20:00)          714287            50

(11/21/06 14:30:00) (11/21/06 14:30:00)          388716          1780

(11/21/06 14:40:00) (11/21/06 14:40:00)          380038          1245



The type of each variable is given below:





idat : 'data.frame':    144 obs. of  3 variables:

 $ Datetime           :Classes 'chron', 'dates', 'times'  atomic
[1:144] 13473 13473 13473 13473 13473 ...

 $ Volume_a           : num  0 0 0 0 0 0 0 0 0 0 ...

 $ Volume_b           : num  0 0 0 0 0 0 0 0 0 0 ...





The variable i am interested is "Datetime".



I exported this dataframe into SAS by the write.foreign command,



write.foreign(idat,"Z:\\New\\idat_d.sas7bdat","Z:New\\idat_c.sas",packag
e="SAS",dataname="f.idat")



When I export, i see only the date value (Note: no time) in my SAS
data set. Why is this?



The write.foreign package says:



"Numeric variables and factors are supported for all packages, dates
and times (Date, dates, date, and POSIXt classes) are also supported
for SAS and characters are supported for SPSS."



So, what should i do to get my time value also apart from the
datevalue? Do i need to convert the chron object, "Datetime" into
POSIXt...or anything alse...so that SAS can read it as datetime.
format?





Thank you,

Shubha.

______________________________________________
R-help op stat.math.ethz.ch 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.



More information about the R-help mailing list