Hello,

It works with me,


d1 <- read.table(text="
ID simloglkhd
1 6.72782753120542
2 3.37685863056105
3 3.28498537979818
4 4.15888243774255
", header=TRUE)
d1
foreign::write.dbf(d1, "test.dbf")

d2 <- foreign::read.dbf("test.dbf")
identical(d1, d2) # FALSE
all(d1 == d2)     # TRUE

attributes(d1) # d1 doesn't have a
attributes(d2) # 'data_types' attribute

unlink("test.dbf") # clean-up


So maybe it's a R version/package version thing? I really don't know, try updating the package. Also, use single forward slashes in the pathnames, the result is exactly the same, but more portable and less messy.

Hope this helps,

Rui Barradas

Em 13-08-2012 12:13, Avishek Dutta escreveu:
Dear all,

I am basically a GIS user and am new to R.

I am trying to write a data frame to a dbf file.

*n.simulations <- 999
binomial <- kulldorff(geo, cases, population, NULL, pop.upper.bound,
n.simulations, alpha.level, plot)
cluster <- binomial$most.likely.cluster$location.IDs.included
df <- data.frame(ID=seq(1,n.simulations,by=1),
simloglkhd=binomial$simulated.log.lkhd)

write.dbf(df,"H:\\CIV\\CIVProject\\DATA\\plotdata.dbf")*

I am getting this error.

*Error in c<logical="L", integer="N",numeric="F",charachetr="C", :
  invalid subscript type 'list'
Calls: write.dbf -> <Anonymous>*

If I added *
write.dbf(df,"H:\\CIV\\CIVProject\\DATA\\plotdata.dbf",factor2char=TRUE,max_char=254)
*

Now, I get error as these are unused arguments.

If I write it to text file using write.table, the text file looks like this.

*"ID" "simloglkhd"
"1" 1 6.72782753120542
"2" 2 3.37685863056105
"3" 3 3.28498537979818
"4" 4 4.15888243774255
.
.
.*

Can anyone please tell me what am I doing worng?

Regards,
Avishek

        [[alternative HTML version deleted]]

______________________________________________
[email protected] 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.

______________________________________________
[email protected] 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