[R] write.dta limits

David Whiting david.whiting at ncl.ac.uk
Tue Jun 7 08:56:06 CEST 2005


Thomas Lumley <tlumley at u.washington.edu> writes:

> On Mon, 6 Jun 2005, Jean Eid wrote:
>
>> Hope everyone id doing great ..
>>
>> Just need some clarification over the limit of write.dta. I have some
>> coauthors that use stata and I need to send them my data in .dta format.
>> the data.frame is 41706x229 and I get the following
>>
>> Error in write.dta(Panel, file = "STATADATA/Panel.dta", version = 7) :
>> 	a binary write error occured
>>
>>
>> Once I subset the data everything works out fine. my question is what are
>> the limits of write.dta. I tried to find out but no luck..
>
>
> There aren't supposed to be any built-in limits. The error message
> that you report means that the low-level operating system calls to
> write data gave an error, so if a limit was hit it was in the
> operating system (?disk full)
>
>  	-thomas


When I have encountered this error message in the past seems to have
resulted from a blank/empty level in a factor or an empty character.
For example:

> library(foreign)
> x <- data.frame(x=c("A", "B", "C"), y=c(1,2,3))
> write.dta(x, file="temp.dta")
> levels(x$x)[2]
[1] "B"
> levels(x$x)[2] <- ""
> write.dta(x, file="temp.dta")
Error in write.dta(x, file = "temp.dta") : 
	a binary write error occurred


My work-around at the time was to go through the data replacing ""
with something else that I could then deal with later. 


-- 
David Whiting
University of Newcastle upon Tyne, UK




More information about the R-help mailing list