Ive got a big column of dates (also some fields dont have a date so they have NA instead), that i have converted into date format as so...
dates<-as.character(data[,"date_commissioned"]); # converted dates to characters dates[1:10] [1] "19910101" "19860101" "19910101" "19860101" "19910101" "19910101" "19910101" "19910101" "19910101" "19910101" dateObs <- as.Date(dates,format="%Y%m%d") dateObs[1:10] [1] "1991-01-01" "1986-01-01" "1991-01-01" "1986-01-01" "1991-01-01" "1991-01-01" "1991-01-01" "1991-01-01" "1991-01-01" "1991-01-01" Now i need to turn the dates into years, how do i do it? Im not worried about fractions of years, whole years would do. -- View this message in context: http://old.nabble.com/Turn-dates-into-age-tp26256656p26256656.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.