Add a Date Column to a .csv File

FFA

New Member
#1
I have the following table in a .csv file.

Date Race Distance H_No H_Name EA Barrier Wt P_Date P_Distance Stage P_Speed
1 19/07/2015 1 1200M 7 BEAT TO QUARTERS 1 56 28/02/2014 1000 Early 63.6
2 19/07/2015 1 1200M 7 BEAT TO QUARTERS 1 56 21/03/2014 1100 Early 62.1
3 19/07/2015 1 1200M 7 BEAT TO QUARTERS 1 56 4/04/2014 1200 Early 64.6
4 19/07/2015 1 1200M 7 BEAT TO QUARTERS 1 56 18/04/2014 1400 Early 64.0


I need to read that .csv file, take the Date column, increase the date by six months to 19/01/2016, and write a new column to the .csv file with the adjusted date. I thought I could do this by simply using as.Date and adjusting the origin to increase the value by six months and add the last column to a data frame and write back. It's not working. Can somebody suggest a way for me to do this?

My code is below.
Code:
ADate <- as.Date(data$Date, origin = "30-06-1900", "%d/%m/%Y")
data <- read.csv("data.csv") 
data <- data.frame(data, ADate) 
write.csv(data, file = "data.csv")
Thanks,
 
Last edited:

FFA

New Member
#3
There is no error message only a lack of functionality.

I need to read that .csv file, take the Date column, increase the date by six months to 19/01/2016, and write a new column to the .csv file with the adjusted date. I thought I could do this by simply using as.Date and adjusting the origin to increase the value by six months and add the last column to a data frame and write back. It's not working. Can somebody suggest a way for me to do this?