move.df.col | R Documentation |
Allows to change the position of a column in a data.frame using other columns as reference.
move.df.col(data.frame, move.command)
data.frame |
An input data.frame. |
move.command |
A string containing the moving command. The command is formed as follows: "columnA movingCommand columnB". The basic options are: "first", "last", "before", "after". Compounded moves must be separated by a semicolon. Example: |
It returns the original data.frame but with the columns moved as demanded.
https://stackoverflow.com/questions/3369959/moving-columns-within-a-data-frame-without-retyping
new.mtcars = move.df.col(mtcars, "mpg last")
new.mtcars = move.df.col(mtcars, "wt before carb")
new.mtcars = move.df.col(mtcars, "am before carb; cyl first")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.