Skip to content
Prev 363561 / 398502 Next

Importint stata file and using value labels

You need to (re-)read the "Introduction to R" document that comes with R. R Is not Stata, and you should not expect R to look syntactically like Stata.

Note that if you, against normal R convention, wish to manipulate the integers that a factor is implemented with,  you can create such a variable using as.integer( sex ), but beware that bad data or changes made to the factor definition before your analysis step will render your assumptions about specific integer values invalid. For example the order of levels for sex might go c("M","F") or c("F","M") so 1 could mean different things based on decisions made elsewhere.