columns_to_factors: Convert columns to factors.

View source: R/reformat.R

columns_to_factorsR Documentation

Convert columns to factors.

Description

Function to convert a data frame with two or more columns of numerical values, where each column corresponds to a specific factor level, into two columns, where the first column contains all of the numerical values and the second column contains their corresponding factor level.

Usage

columns_to_factors(
  data,
  response.name = NULL,
  factor.name = NULL,
  level.names = NULL
)

Arguments

data

the data frame containing the (two or more) numerical columns.

response.name

the name for the response column in the new data frame

factor.name

the name for the factor (categorical variable) column in the new data frame

level.names

a vector containing the desired names for the factor levels.


ddarmon/MUsaic documentation built on June 19, 2024, 6:43 p.m.