I have a data frame that has columns a, b, and c. I\'d like to add a new column d between b and c.
I know I could just add d at the end by using cbind but h
Here is a an example of how to move a column from last to first position. It combines [ with ncol. I thought it would be useful to have a very short answer here for the busy reader:
[
ncol
d = mtcars d[, c(ncol(d), 1:(ncol(d)-1))]