Learn R Programming

eatGADS (version 1.1.1)

relocateVariable: Reorder a single variable in a GADSdat.

Description

Reorder a single variable in a GADSdat. The variable (var) can be inserted right after another variable (after) or at the beginning of the GADSdat via after = NULL.

Usage

relocateVariable(GADSdat, var, after = NULL)

Value

Returns a GADSdat object.

Arguments

GADSdat

A GADSdat object.

var

Character string of the variable name which should be sorted.

after

Character string of the variable name after which var should be inserted. If NULL, var is inserted at the beginning of the GADSdat.

Details

The variables in the dat and in the labels section are ordered. For reordering the whole GADSdat, see orderLike.

Examples

Run this code
# Insert variable 'migration' after variable 'idclass'
pisa2 <- relocateVariable(pisa, var = "migration", after = "idclass")

# Insert variable 'idclass' at the beginning of the data set
pisa2 <- relocateVariable(pisa, var = "idclass", after = NULL)

Run the code above in your browser using DataLab