[R] dates from Stata's .dta to R's .Rdata: become character

John Fox jfox at mcmaster.ca
Mon May 4 01:01:50 CEST 2009


Dear Rob,

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of Rob Bakker
> Sent: May-03-09 7:46 AM
> To: r-help at r-project.org
> Subject: [R] dates from Stata's .dta to R's .Rdata: become character
> 
> Dear Sir/Madam,
> I converted the .dta into .Rdata with the foreign library read.dta.
However,
> when I use fix() I get the message that the dates are discarded.
> Before fix(), class(dateX) gives 'dates' as class; after fix()
class(dateX)
> gives 'character'
> Why is that?

Because fix() can't handle date columns in a data frame. Look at ?fix and
click the link for edit.data.frame :  " At present, this only works on
simple data frames containing numeric, logical or character vectors and
factors, and numeric, logical or character matrices. Any other mode of
matrix will give an error, and a warning is given when the matrix has a
class (which will be discarded)."

I hope this helps,
 John

> 
> Best regards,
> 
> Rob Bakker
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list