n = ncol(temp_df1) nperiods = nrow(temp_df1) temp_df1 = temp_df1/ matrix(coredata(xts::first(temp_df1)), nr=nperiods, nc=n, byrow=T)