dssPivot: Widen a dataframe using reshape2::dcast

View source: R/dssPivot.R

dssPivotR Documentation

Widen a dataframe using reshape2::dcast

Description

This function transforms long format data to wide format using the function dcast from the package reshape2.

Usage

dssPivot(
  symbol,
  what,
  value.var,
  cols = NULL,
  formula = NULL,
  by.col = NULL,
  completeCases = FALSE,
  fun.aggregate = NULL,
  datasources = NULL,
  async = FALSE
)

Arguments

symbol

a character name of the new dataframe in wide format

what

a character name of data frame in CDISC format

value.var

name of the column which stores values, this goes straight into the parameter value.var in reshape2::dcast

cols

a vector of columns used in the formula. They must exist in 'what'. If null, all the columns from 'what' will be used.

formula

the formula to use by reshape2::dcast. If left null a weak attempt will be made at automatically guessing it.

by.col

typically the patient id, the column that will end up as key of the resulting 'wide' data.frame. In most cases this can be left null as it's been set when the package was loaded

completeCases

a logical, keep only complete cases?

fun.aggregate

a function, see fun.aggregate in reshape2::dcast. Note: if the widening needs an aggregate function and none is provided, ds2.pivot will fail (unlike reshape2::dcast)


sib-swiss/dsSwissKnifeClient documentation built on July 16, 2025, 6:25 p.m.