I have a data set I'm working with in R and it has 138 entries. One of the questions I am working with is in the form of a character, and is from a survey where people can respond if they are introverts or extroverts.
How can I change every entry of this question to a number i.e. Introvert = 1, Extrovert = 2
I tried to convert it to a factor but the result was this: $ Personality: Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
Any ideas?
Here is the str(classdata20):
'data.frame': 138 obs. of 3 variables:
$ GPA : num 3.3 3.3 3.3 3.4 3 3.25 3.3 3.8 3.3 3.6 ...
$ Personality: Factor w/ 0 levels: NA NA NA NA NA NA NA NA NA NA ...
$ Income : num 3000000 150000 500000 250000 500000 120000 120000 1000000 200000
200000 ...