I have a Stata
data-set with 0,1
I am reading into R
using
aa <- haven::read_dta("trial_data.dta")
table(aa$malpos)
When its loaded in R
the variable is comes in with 1,2
categories instead of 0,1
. Is there a way I can avoid this?
simply try this:
library(dplyr)
library(haven)
aa %>%
as_factor()