[R] dbWriteTable with row.names=(TRUE | FALSE)
Hansruedi Baetschmann
habae at fgcz.ethz.ch
Fri Aug 8 21:25:08 CEST 2008
Hello
Saving a dataframe with dbWriteTable to a relational database with the
parameter row.names set to FALSE works fine, doing so the parameter set
to TRUE gives an error message "/Fehler in field.types$row.names : $
operator is invalid for atomic vectors/" (see the protocol below).
I work with R Ver.2.7.1
What am I doing wrong ?
Thanks
Hansruedi Baetschmann
-----------------------------------------------------------------------
dipl.math.ETH et.lic.oec.HSG
Functional Genomics Center Zurich
Winterthurerstrasse 190 / Y32H66
CH-8057 Zürich
-----------------------------------------------------------------------
> library("RMySQL")
> con=dbConnect("MySQL",dbname="dataframes",user="root",
password="xxxxx",host="localhost" )
> dbGetInfo(con)
...
$serverVersion
[1] "5.0.24-community-nt-log"
$protocolVersion
[1] 10
...
> dbListTables(con)
character(0)
> df1=data.frame(a=c(1,2,3,4),b=c("a","b","c","d"))
> df1
a b
1 1 a
2 2 b
3 3 c
4 4 d
> dbWriteTable(con,"df1_without_rownames",df1,row.names=FALSE)
[1] TRUE
> dbListTables(con)
[1] "df1_without_rownames"
> dbWriteTable(con,"df1_with_rownames",df1,row.names=TRUE)
Fehler in field.types$row.names : $ operator is invalid for atomic vectors
--------------------------------------------------------------------end
More information about the R-help
mailing list