So, I have a dataset and need to do some works using a for loop.
Here is my fake data:
#fake data
L <- data.frame(matrix(rnorm(20), nrow=10, ncol=10))
names(L) <- c("P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9","P10")
Now, I want to apply a function to the entire column and remove the column "P1". Then, run the function again and remove "P5" so on.
Here is the order of removing.
# order of removing column
R < c(P1, P5, P2, P8, P9, P4, P3, P6, P7)
What can I try next?