I think should give you what you're looking for:
Imp1 <- 32.1
req <- paste("INSERT INTO important (num_cluster,type,indicateur_imp)
VALUES (1,'temperature',",Imp1, ")",sep="")
That will output:
[1] "INSERT INTO important (num_cluster,type,indicateur_imp) VALUES (1,'temperature',32.1)"
paste() will take any variable and return it's value as a string, and you chain items together with commas. You can end the statement with a sep= parameter. To be the most literal (which I like doing for queries) I just use sep = "" and type the whole thing literally. So If I had multiple values I wanted to insert I would do something like this:
var1 <- round(rnorm(5))
var2 <- c("'temp'","'pressure'","'precip'","'volume'","'mass'")
for(i in 1:length(var1)){
req <- paste("INSERT INTO important (num_cluster,type,indicateur_imp) VALUES
(1,",var2[i],",",var1[i],")",sep="")
# not run, but do to send your query
# dbSendQuery(conn,req)
print(req)
}
That will send the following queries:
[1] "INSERT INTO important (num_cluster,type,indicateur_imp) VALUES (1,'temp',0.09)"
[1] "INSERT INTO important (num_cluster,type,indicateur_imp) VALUES (1,'pressure',0.04)"
[1] "INSERT INTO important (num_cluster,type,indicateur_imp) VALUES (1,'precip',-1.2)"
[1] "INSERT INTO important (num_cluster,type,indicateur_imp) VALUES (1,'volume',0.78)"
[1] "INSERT INTO important (num_cluster,type,indicateur_imp) VALUES (1,'mass',1.15)"
pasteorsprintf.paste, but you didn't usepaste. Comparepaste("some text Imp")andpaste("some text",Imp).