I have the following dataframe:
xR <- data.frame("A" = c(15, 13.5, 12, 9.1, NA, NA, NA, NA),
"B" = c(NA, 13.6, 8.4, 6.7, 5.6, 2.0, NA, NA),
"C" = c(NA, NA, 8.5, 2.43, 1.23, NA, NA, NA))
How do I shift the rows in columns B and C up by 1 row to get:
xR1 <- data.frame("A" = c(15, 13.5, 12, 9.1, NA, NA, NA, NA),
"B" = c(13.6, 8.4, 6.7, 5.6, 2.0, NA, NA, NA),
"C" = c(NA, 8.5, 2.43, 1.23, NA, NA, NA, NA))
My dataframe has 100+ columns so trying to automate it. Thanks for your help