I have a dataset from a survey where "yes" and "no" have been assigned 0 & 1 but NAs have been given the value 88888
library(dplyr)
library(corrr)
a <- sample(c(0,1,88888),25,replace =T)
x <- sample(c(0,1,88888),25,replace =T)
y <- sample(c(0,1,88888),25,replace =T)
z <- sample(c(0,1,88888),25,replace =T)
dat<-tibble(a,x,y,z)
r is treating all of the data as numeric. I am trying to get a correlation between "a" and each of the other variables.
cor<-dat%>%
correlate()%>%
focus(a)
My results are a real mess!
The only solution that I can think of is to set all of the 88888 values to NA, but hoping that there is a better way to deal with this? The data that I am using has >200 categorical variables to consider and about 30 numeric
Thanks!