Hi! Here I am with an other newbie question.
I am importing a CSV file that looks like this:
"username","interest","has_card"
"test01","not_interesting",1
"test02","maybe_interesting",0
"test03","not_interesting",0
"test04","maybe",1
mydata <- read.table(file("test.csv", encoding = "UTF-8"), header=TRUE, sep=",")
Then (maybe it sounds like a newbie stupid question) why I can get the levels for string based stuff, like this:
> levels(mydata$interest)
[1] "maybe" "maybe_interesting" "not_interesting"
But not for binary (integer) based stuff.
> levels(mydata$has_card)
NULL
What I am doing is a barplot for frequencies table, I basically need to rename the labels 0,1 to something like "No", "Yes" in the plot legend. But I can't do:
levels(mydata$has_card)[1] <- "Yes"
levels(mydata$has_card)[0] <- "No"
Like I would do it with "maybe" "maybe_interesting" "not_interesting"