Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created December 6, 2013 10:54
Show Gist options
  • Save qoelet/7821921 to your computer and use it in GitHub Desktop.
Save qoelet/7821921 to your computer and use it in GitHub Desktop.
# reverse columns in a data frame
reverse_df <- function(df) {
col_names <- names(df)
for(col_idx in 1:length(col_names)) {
df[[col_idx]] <- rev(df[[col_idx]])
}
return(df)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment