0

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)

Link to data

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?

camille
  • 16,432
  • 18
  • 38
  • 60
Keniajin
  • 1,649
  • 2
  • 20
  • 43

1 Answers1

0

simply try this:

library(dplyr)
library(haven)

aa %>%
  as_factor()
Stephan
  • 2,056
  • 1
  • 9
  • 20