When I run sqldf to merge two datasets, it's changing the Date (class date) to a numeric value (class factor). Not sure why. Appreciate any insight. Console output for two datasets and the merged dataset (via sqldf) listed below.
> summary(df.aggregate) Date Hour x Min. :2010-07-01 0 : 64 Min. : 0.00 1st Qu.:2010-07-25 1 : 64 1st Qu.: 1.00 Median :2010-08-16 2 : 64 Median : 9.00 Mean :2010-08-16 3 : 64 Mean :11.77 3rd Qu.:2010-09-08 4 : 64 3rd Qu.:23.00 Max. :2010-09-30 5 : 64 Max. :32.00 (Other):1152 > class(df.aggregate$Date) [1] "Date" > summary(df.possible.combos) Date Hour Min. :2010-07-01 Min. : 0.00 1st Qu.:2010-07-25 1st Qu.: 5.75 Median :2010-08-16 Median :11.50 Mean :2010-08-16 Mean :11.50 3rd Qu.:2010-09-08 3rd Qu.:17.25 Max. :2010-09-30 Max. :23.00 > class(df.possible.combos$Date) [1] "Date" > #merge raw data and all possible combinations > df.final <- sqldf('select Date, Hour, x as RoomsInUse from > "df.possible.combos" + left join "df.aggregate" using (Hour, Date)') > summary(df.final) Date Hour RoomsInUse 14791.0: 24 Min. : 0.00 Min. : 0.00 14792.0: 24 1st Qu.: 5.75 1st Qu.: 1.00 14796.0: 24 Median :11.50 Median : 9.00 14797.0: 24 Mean :11.50 Mean :11.77 14798.0: 24 3rd Qu.:17.25 3rd Qu.:23.00 14799.0: 24 Max. :23.00 Max. :32.00 (Other):1392 > class(df.final$Date) [1] "factor" -- View this message in context: http://r.789695.n4.nabble.com/class-changed-after-execution-with-sqldf-tp3024592p3024592.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.