df.move | R Documentation |
This function moves variables to a different position in the data frame, i.e.,
changes the column positions in the data frame. By default, variables specified
in the first argument ...
are moved to the first position in the data
frame specified in the argument data
.
df.move(..., data = NULL, before = NULL, after = NULL, first = TRUE, check = FALSE)
... |
an expression indicating the variable names in |
data |
a data frame. |
before |
a character string indicating a variable in |
after |
a character string indicating a variable in |
first |
logical: if |
check |
logical: if |
Returns the data frame in data
with columns in a different place.
Takuya Yanagida takuya.yanagida@univie.ac.at
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
df.duplicated
, df.merge
,
df.rbind
,
df.rename
, df.sort
,
df.subset
# Example 1: Move variables 'hp' and 'am' to the first position
df.move(hp, am, data = mtcars)
# Example 2: Move variables 'hp' and 'am' to the last position
df.move(hp, am, data = mtcars, first = FALSE)
# Example 3: Move variables 'hp' and 'am' to the left-hand side of 'disp'
df.move(hp, am, data = mtcars, before = "disp")
# Example 4: Move variables 'hp' and 'am' to the right-hand side of 'disp'
df.move(hp, am, data = mtcars, after = "disp")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.