I have written some .R script to create a table and a new column in my DF to allow for a date column to create some time series analysis. I want to fill the empty column with dates starting at 2020-03-07 and +1 for every row below. However my for loop isn't working. Wondering what I might be missing here
#Create Empty date colummn
CFR_Table$Date <- NA
#Fill Date Column With Dates Starting @ 2020-03-07
for (i in CFR_Table$Date) {
as.Date("2020-03-07") + 1
}
The problem with your for loop is that it produces the same value every iteration and it does not assign the calculated value to the data frame; it merely calculates the value.