[R-sig-DB] adding to a MySQL database from within R?

Jack Tanner |hok @end|ng |rom hotm@||@com
Sat Oct 9 06:23:12 CEST 2010


I think you're looking for an INSERT query, no?

On 10/9/2010 12:00 AM, Spencer Graves wrote:
> Hello, All:
>
>
> How can I add rows to a MySQL database?
>
>
> I can do it manually within MySQL server 5.1.50-community. I can connect
> to it using the RMySQL package. When I tried "dbReadTable {DBI}", I got
> a warning that "table headers exists:
>
>
>  > MySQL. <- MySQL()
>  > MySQLcon <- dbConnect(MySQL., user=User, password=pw, dbname=myDB)
>  > dbWriteTable(MySQLcon, 'headers', a.data.frame)
> Warning message:
> In mysqlWriteTable(conn, name, value, ...) :
> table headers exists in database: aborting mysqlWriteTable
>
>
> I know that table "headers" exists: I want to add to it, not create the
> entire table from scratch at once.
>
>
> Thanks,
> Spencer
> sessionInfo()
> R version 2.11.1 (2010-05-31)
> i386-pc-mingw32
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] SIM_1.1-5 RCurl_1.4-3 bitops_1.0-4.1
> [4] R2HTML_2.1 oce_0.1-80 TSMySQL_2010.5-1
> [7] RMySQL_0.7-5 DBI_0.2-5 TSdbi_2010.5-1
> [10] tframePlus_2009.10-2 tframe_2009.10-1
>
> loaded via a namespace (and not attached):
> [1] tools_2.11.1
>  >
>




More information about the R-sig-DB mailing list