Description Usage Arguments Value Note See Also Examples
Move the columns of a dataframe relative to each other.
1 | move_columns(x, who, before = NULL, after = NULL)
|
x |
a dataframe. |
who |
A character vector of column names to move, or a logical vector of length names(x), or a vector of indices |
before |
the column before which to put |
after |
the column after which to put |
A data frame with shuffled columns.
This function has been modified from archived package metrumrg
where it was named shuffle
.
https://github.com/cran/metrumrg/blob/master/R/shuffle.R.
1 2 3 4 5 6 7 8 9 10 | ## Not run:
data(iris)
iris.new <- move_columns(iris, "Species", after = NA) # move species to last column
iris.new <- move_columns(iris, "Species", after = 2)
iris.new <- move_columns(iris, "Species", after = "Sepal.Length")
iris.new <- move_columns(iris, "Species", before = NA) # move species to first column
iris.new <- move_columns(iris, "Species", before = 3)
iris.new <- move_columns(iris, "Species", before = "Petal.Length")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.