[R] Column width in dbf file ... again ...

Arnaud Mosnier a.mosnier at gmail.com
Wed Feb 10 14:41:30 CET 2010


First please excuse me for reposting the same question I sent a few
weeks ago, but I did not have any answer !

I am trying to "manually" choose the width (i.e. number of character
allowed) of columns containing text when creating dbf. files using
write.dbf (library foreign).
In particular, I want to define this width when the column have to
contain text but is empty.

In that case, by default, write.dbf give a warning message then choose
the width equal to the number of character in the column title.


df<-data.frame(INDEX=1:10, TEXT=NA_character_)
write.dbf(df, paste(choose.dir(), "//test.dbf",sep=""))
# Give a warning message but create the dbf file. The width of the
column "TEXT" is 4 as the number of character in the word TEXT !

Thanks for your help,

P.S. : complementary info. R version 2.10.1 (2009-12-14) i386-pc-mingw32

More information about the R-help mailing list