take a set of traits and turn into a string

Share:

Description

this is a helper function that is useful when we wish to make several traits into one variable

Usage

1
traits.to.string(data, traits, na.action = "drop", sep = ".")

Arguments

data

the respondent info

traits

the names of the traits to build the model on

na.action

for now, defaults to 'drop' (meaning all rows of data with any missingness on the traits are dropped). anything else NAs are treated like any other value

sep

the separator character used to combine values

Value

a list whose entries are used.idx, which indicates which rows from the original dataset were used (may not be all of if there is missingness); and traits, which has the string version of the traits