[R] Importint stata file and using value labels

Robert Baer rbaer at atsu.edu
Sat Aug 27 18:44:13 CEST 2016


There has been some good advice not to lose the labels, but perhaps this 
gets you where you seem determined to go?

?read.dta

read.dta(file, convert.dates = TRUE, convert.factors = TRUE,
          missing.type = FALSE,
          convert.underscore = FALSE, warn.missing.labels = TRUE)

or

library(readstata13)

?read.dta13

read.dta13(file, convert.factors = TRUE, generate.factors = FALSE,
   encoding = NULL, fromEncoding = NULL, convert.underscore = FALSE,
   missing.type = FALSE, convert.dates = TRUE, replace.strl = FALSE,
   add.rownames = FALSE, nonint.factors = FALSE)

Perhaps the convert. factors setting at FALSE?


On 08/27/2016 10:55 AM, Michael Friendly wrote:
> On 8/26/2016 11:05 AM, Juan Ceccarelli Arias wrote:
>> Yep. Im a bit stalled.
>> I can't find the option to import only the values and drop the value 
>> labels
>> from the dta file.
>> Im quite sure R can do that. Then i'd only used the values and i'd 
>> rely on
>> my memory.
>> It isn't a bad alternative.
>>
>
> Hint: use str() to see the class of what you've read.
> Then try as.data.frame() on the resulting object read from the .dta file.
>
>



More information about the R-help mailing list