readstata13/memisc - Is it possible to prevent convert.factors starting from 1? Negative Missings not recognized.

Hi everybody,

I want to open a Stata Dataset in R and used readstata13 to keep the labels. This is not possible in a similar way with haven. Now there is the problem that concert.factors=TRUE keeps the labels but converts the numbers starting from 1. That means my negative missings from the Stata Dataset and also codings with 0 are changed starting from 1. If the numbers e.g. where -897, -898, 1, 2, 3, they are in R transformed to 1,2,3,4,5. So the missings are suddenly on numbers 1 and 2 instead of the negative ones.
This is my code:

pp2014p_stata13 <- read.dta13("phd2014_p_d_4-0-0.dta", 
                              encoding = NULL,
                              nonint.factors = TRUE,

I now read in a publication by Martin Elff, that this problem can somehow be solved by using the memisc package. But I have no idea how this should work.

I would try this line for the missings
valid.values (pp2014p_stata13>0)

but I´m not sure how this could be integrated in the code above. If I run this directly after readstata13, the changes have been already done. Is there a possibility to include code for both packages in one?

Thank you for useful hints and tips in advance!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.