Skip to content
Prev 68288 / 398503 Next

R closes unexpectedly with write.dbf()

Dear R-list,

I am trying to do a relatively simple manipulation in R on a dbf file and then write the dbf file back out the file system. Here are the commands:

(load the foreign library package) 
union <- read.dbf("C:/ITRSampleData/fromGrass/union.dbf", as.is=FALSE) 
attach(union) 
union$wu_fract <- area_union*a_SUM/a_area_tor 
detach(union) 
write.dbf(union, "C://ITRSampleData/fromR/union_postR.dbf") 

after I run the last command, Windows tells me that R has encountered a problem and needs to shut down. It also asks if I want to report the problem to microsoft... R then shuts down completely. 

I have tried this with the factor2char=TRUE and FALSE, with the same result. 
I checked is.data.frame(union) and it is true.

An empty dbf file is created in the correct place, so I know R has access/permissions and my file path is correct.

I have used the write.dbf command in a number of other places and have never run into this problem. 

I am running R 2.0.0 on windows xp.

Any ideas?

Thanks in advance,
Robin Schroeder