I need to calculate the number of days elapsed between multiple dates in two ways and then output those results to new columns: i) number of days that has elapsed as compare
For the first part:
DATA = data.frame((c("7/8/2013", "8/1/2013", "8/30/2013", "10/23/2013","12/16/2013", "12/16/2015"))) names(DATA)[1] = "V1" date = as.Date(DATA$V1, format="%m/%d/%Y") print(date-date[1])
Result:
[1] 0 24 53 107 161 891
For second part - simply use a for loop
for