Another issue I wasn't able to fix yet: I would like to recode a variable that is a character into factor in order to create a histogram. Unfortunately, recoding with "as.numeric()" doesn't work (same as some other things I have tried), probably because of some missing values or two observations with a string (rows 98 and 365).
Has anyone encountered a similar problem or knows how to fix this? Here's the code for reproduction of the issue.
is.numeric(Model_1_Dataset$rtypesup_cat) # already indicates that it didn't work
Create the histogram
hist(Model_1_Dataset$rtypesup_cat, main = "Frequency of Rebel Support Types", xlab = "Rebel Support Types", las = 1, breaks = seq(.5,3.5,1), col = "lightyellow")
Hi everyone,
Another issue I wasn't able to fix yet: I would like to recode a variable that is a character into factor in order to create a histogram. Unfortunately, recoding with "as.numeric()" doesn't work (same as some other things I have tried), probably because of some missing values or two observations with a string (rows 98 and 365).
Has anyone encountered a similar problem or knows how to fix this? Here's the code for reproduction of the issue.
Load relevant dataset
Model_1_Dataset <- read.csv("https://raw.githubusercontent.com/KatrinHeger/CollaborativeResearchProject/master/Model_1_Dataset.csv")
Recode into numeric
as.numeric(Model_1_Dataset$rtypesup_cat)
is.numeric(Model_1_Dataset$rtypesup_cat) # already indicates that it didn't work
Create the histogram
hist(Model_1_Dataset$rtypesup_cat, main = "Frequency of Rebel Support Types", xlab = "Rebel Support Types", las = 1, breaks = seq(.5,3.5,1), col = "lightyellow")
Thank's a lot!
Best,
Benedikt