I want to use R package forcats
to turn my data from character to factor.My data was stored as strings in a "xlsx." file. I wonder why it turns to NA?
Here is the screenshot on my computer when I run the code.
library("tidyverse")
library(readxl)
library(forcats)
conjoint_analysis <- read_excel("OneDrive/\u9879\u76ee/\u8054\u5408\u5206\u6790(\u822a\u5609\u6167\u5e08\u59d0)/conjoint_analysis.xlsx")
a <- c('male','female','male','male','female')
print(factor(a))
print(conjoint_analysis[,3])
print(factor(conjoint_analysis[,3]))