Search code examples
rdataframelevels

remove level from a list extract to a data fram


I have a data frame like this

    df <- data.frame(letters=letters[1:5], numbers=seq(1:5))

and lets say that I want to extram the first column into a list

firstColumn <- df[,1]

>  firstColumn[[1]]
[1] a
Levels: a b c d e

Problème is I want to remove the level to have a string

any help please ?

thanks


Solution

  • If I understand your question, you're trying to convert to character.

    Try

    as.character(firstColumn[[1]])