Skip to content
Prev 318009 / 398506 Next

Having trouble converting a dataframe of character vectors to factors

Pleaser re-read ?sapply and pay particular attention to the "simplify" argument.

The following should help explain the issues:
a           b
"character" "character"
a           b           c           d           e           f
"character" "character" "character" "character" "character" "character"
a        b
"factor" "factor"
a        b
"factor" "factor"
$a
[1] a b c
Levels: a b c

$b
[1] d e f
Levels: d e f

## Note that both z2 and z3 are lists, and would have to be converted
back to data frames.

-- Bert
On Wed, Feb 20, 2013 at 4:09 PM, Lopez, Dan <lopez235 at llnl.gov> wrote: