R/move_variables_df.R

Defines functions move_variables_df

Documented in move_variables_df

## File Name: move_variables_df.R
## File Version: 0.02

##-- move variables in a data frame
move_variables_df <- function(x, after_var, move_vars)
{
    cnx <- colnames(x)
    i1 <- which(cnx==after_var)
    vars1 <- cnx[ seq(1,i1) ]
    vars2 <- move_vars
    vars3 <- setdiff( cnx, c(vars1, vars2) )
    x <- x[, c(vars1, vars2, vars3) ]
    return(x)
}

Try the sirt package in your browser

Any scripts or data that you put into this service are public.

sirt documentation built on Aug. 11, 2023, 5:07 p.m.