When reading data from SPSS or Stata into R, the metadata will also be inherited to the dataset. Sometimes it can be useful for extra information, but most of the time it’s not needed. To get rid of these metadata then do this:

attr(myData$VAR, "format.stata") <- NULL
attribute(myData$VAR) <- NULL
df[] <- lapply(df, as.vector)
df <- df[, lapply(.SD, as.vector)]

References from StackOverflow

comments powered by Disqus