sort_by_key: Sort Rows by Key Sequence

View source: R/sort.R

sort_by_keyR Documentation

Sort Rows by Key Sequence

Description

This function sorts the dataset according to the key sequence found in the metacore object.

Usage

sort_by_key(data, metacore, dataset_name = NULL)

Arguments

data

Dataset to sort

metacore

metacore object that contains the specifications for the dataset of interest.

dataset_name

Optional string to specify the dataset. This is only needed if the metacore object provided hasn't already been subsetted.

Value

dataset with ordered columns

Examples

library(metacore)
library(haven)
library(magrittr)
load(metacore_example("pilot_ADaM.rda"))
spec <- metacore %>% select_dataset("ADSL")
data <- read_xpt(metatools_example("adsl.xpt"))
sort_by_key(data, spec)

metatools documentation built on March 31, 2023, 5:19 p.m.