hsMatrixToListForm: Convert "Matrix Form" (wide format) to "List Form" (long...

View source: R/main.R

hsMatrixToListFormR Documentation

Convert "Matrix Form" (wide format) to "List Form" (long format)

Description

Converts a data frame in "matrix form" to a data frame in "list form"

Usage

hsMatrixToListForm(
  df,
  keyFields,
  parFields = setdiff(names(df), keyFields),
  colNamePar = "parName",
  colNameVal = "parVal",
  stringsAsFactors = FALSE
)

Arguments

df

data frame

keyFields

names of key fields (e.g. date/time)

parFields

names of fields representing differen parameters. Default: column names that are not in keyFields

colNamePar

name of column in result data frame that will contain the parameter names

colNameVal

name of column in result data frame that will contain the parameter values

stringsAsFactors

if TRUE, columns of type character in the result data frame are converted to factors. Parameter is passed to cbind, rbind.

Value

data frame in "list form" (long format)

See Also

reshape


KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.