'Add Days to Date is 1st Row of Dataframe

I have 1st line of DataFrame as shown below.

I need to increment 7 days from df[1,17] till df[1,40]

I have written code like as follows

But it throws error

Please help

for(i in 1:23){
  
  test1[1,i + ncol(test1)] <- test1[1, ncol(test1)] + 7
  
}

error message:

Error in [<-.data.frame(*tmp*, 1, i + ncol(test1), value = 18917) : new columns would leave holes after existing columns

enter image description here



Solution 1:[1]

I resolved error by creating empty columns in existing DF

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rob