Skip to contents

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