How to change factor labels into string in a data frame

前端 未结 3 1746
挽巷
挽巷 2020-12-17 15:50

I have the following data frame:

    name1  name2
        A      B
        B      D
        C      C
        D      A

the columns \"name1\"

3条回答
  •  轮回少年
    2020-12-17 16:17

    If you want to convert only the selected column of factor variable instead of all the factor variable columns in the data frame, you can use:

    file1[,n] <- sapply(file1[,n], as.character)
    

    where n is the column number.

提交回复
热议问题