Re: [R] Insert a recorde into a table using SQL

2008-05-12 Thread Gabor Grothendieck
Create an encoding function which replaces single quotes with two single quotes: # first string is a single character consisting of single quote # second string is two characters consisting of two single quotes enc - function(x) gsub(', '', x) dbGetQuery(con,sprintf(insert into dd (txt) values

Re: [R] Insert a recorde into a table using SQL

2008-05-12 Thread ronggui
It works. Thanks very much. Best On Mon, May 12, 2008 at 7:02 PM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Create an encoding function which replaces single quotes with two single quotes: # first string is a single character consisting of single quote # second string is two characters

[R] Insert a recorde into a table using SQL

2008-05-11 Thread ronggui
Dear list, I want to insert a recorde into a SQLite table by dbGetQuery(), but there is a problem when the value contains quotation mark. dd-data.frame(txt=c(having both ' and \ in character.,OK)) library(RSQLite) Loading required package: DBI con-dbConnect(dbDriver(SQLite),:memory:)