Hi All, I am creating date column on my data but getting the following error:
#add date column dat1$Date=paste(as.Date(dat1$Year,dat1$Month, dat1$Day, sep="-"))Error in as.Date.numeric(origin, ...) : 'origin' must be supplied I will appreciate any help from you guys. Thanks. Here is the data. dput(head(dat1))structure(list(Year = c(1984L, 1984L, 1984L, 1984L, 1984L, 1984L ), Month = c(1L, 1L, 1L, 1L, 1L, 1L), Day = 1:6, WindSpeed = c(5L, 4L, 4L, 3L, 5L, 6L), Sunshine = c(6.3, 4.8, 0.6, 8.2, 7.3, 1.7 ), Tmax = c(27.4, 26.3, 22.9, 27.7, 28.5, 25.5), Tmin = c(14.5, 16, 14.4, 14.8, 16.6, 15.4), Hmax = c(100L, 95L, 97L, 100L, 97L, 99L), Hmin = c(45L, 62L, 72L, 55L, 54L, 63L), Station.Name = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "KIGALI AERO", class = "factor"), Elevation = c(1490L, 1490L, 1490L, 1490L, 1490L, 1490L), Longitude = c(30.11, 30.11, 30.11, 30.11, 30.11, 30.11), Latitude = c(-1.95, -1.95, -1.95, -1.95, -1.95, -1.95)), .Names = c("Year", "Month", "Day", "WindSpeed", "Sunshine", "Tmax", "Tmin", "Hmax", "Hmin", "Station.Name", "Elevation", "Longitude", "Latitude"), row.names = c(NA, 6L), class = "data.frame") Best Regards, Fredo Frederic Ntirenganya Maseno University, African Maths Initiative, Kenya. Mobile:(+254)718492836 Email: fr...@aims.ac.za https://sites.google.com/a/aims.ac.za/fredo/ [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.