---------- Forwarded message ---------- From: Shubha Vishwanath Karanth <[EMAIL PROTECTED]> Date: Nov 24, 2006 7:54 PM Subject: Dates Conversion/write.foreign To: Shubha Karanth <[EMAIL PROTECTED]>, Shubha Vishwanath Karanth <[EMAIL PROTECTED]>
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",package="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@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.