We have the same problem. And we reported as bug:
https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15166

Hope someone can help

Orvalho

On Wed, Jan 16, 2013 at 8:05 PM, voldermatt <matt.pece...@gmail.com> wrote:

> Thanks in advance.
>
> I pass data sets between R and Stata and think dta files would be the best
> files for this. To do this I can use package foreign or package memisc. I
> mostly use foreign, although have used memisc and this problem mostly
> didn't
> happen, but created errors at other times.
>
> I have a csv data set (and created a test case) with with at least one
> column completely missing.  This eventually creates the error. My list of
> commands are:
>
> data <- read.csv(file, colClasses = "character")
> write.dta(data, newFile)
> read.dta(newFile)
> Error in read.dta(newFile) :
>   a binary read error occurred
>
> The colClasses specificiation is important. This causes the error. Stata 10
> and Stata 11 can read the file. Stata 12 is completely lost looking at the
> dataset. I know this is an R forum, but the data set acts very strangely in
> Stata so I will continue. For my larger data set if I drop one of my
> variables, all variables that are all missing are dropped. Either there is
> an issue with how the data sets are being saved/stored, or I am doing
> something incorrectly by specifying the "character" option in read.csv.
>
> I run R version 2.15.1.
>
> Matt
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Read-dta-and-Write-dta-Binary-Data-Error-tp4655754.html
> Sent from the R help mailing list archive at Nabble.com.
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to