Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

reshapeTranspose

Transpose Data


Description

Transpose data via transpose. All predictors, responses, groups, and auxiliaries are transpose.

Usage

reshapeTranspose(
  dataset = cs.in.dataset(),
  groups = cs.in.groupvars(),
  scriptvars = cs.in.scriptvars(),
  return.results = FALSE,
  ...
)

Arguments

dataset

[data.frame]
Dataset with named columns. The names correspond to predictors and responses.

groups

[character]
Character vector of group variables.

scriptvars

[list]
Named list of script variables set via the Cornerstone "Script Variables" menu. For details see below.

return.results

[logical(1)]
If FALSE the function returns TRUE invisibly. If TRUE, it returns a list of results. Default is FALSE.

...

[ANY]
Additional arguments to be passed to transpose . Please consider possible script variables (scriptvars) to prevent duplicates.

Details

One script variables is summarized in scriptvars list:

split

[character(1)]
Split character to split response names into multiple columns. Default is “_”.

Value

Logical [TRUE] invisibly and outputs to Cornerstone or, if return.results = TRUE, list of resulting data.frame object:

reshapeTranspose

Dataset with transposed data.

Examples

# Data to transform:
library(data.table)
dtTest = data.table(i_1 = c(1:4, NA, 5), i_2 = c(51, 61, NA , 71, 81, 91))
# Reshape to long format:
reshapeTranspose(dtTest, groups = character(0), list(convert.numeric = TRUE), return.results = TRUE)

CornerstoneR

Collection of Scripts for Interface Between 'Cornerstone' and 'R'

v2.0.2
GPL-3
Authors
Gerrith Djaja [aut, cre], Dirk Surmann [aut] (<https://orcid.org/0000-0003-0873-137X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.