Hi I am trying to multiply a column with multiple other columns in my dataset. I am trying to use a loop but it doesn't work. The code returns a warning message but does not create the desired variables
for (i in 1951:2010) {
data$reg2_year_[i] <- data$reg_2 * data$year_[i]
}
I was expecting it to create the variables: reg2_year_1951...reg2_year_2010