我正在使用运行数据库查询
sqldf
在光彩夺目的R.
用户界面:
observeEvent (input$uploadForTest_1, {
inFile=input$uploadForTest_1
inFileName=input$uploadForTest_1$name
file <-"tss.txt"
tmp = paste("audio/street", inFileName, sep = "/")
res <- read.csv.sql(file,header=FALSE,sql = "select * from file where V1=tmp",sep="\t")
print(res)
})
我已成功运行以下查询:
res <- read.csv.sql(file,header=FALSE,sql = "select * from file where V1='audio/street/b098.wav'",sep="\t")
但是,如果我运行中提到的查询
ui.R
这给了我一个错误
tmp
列不存在:
警告:结果创建错误:没有这样的列:tmp 86:
我不想在我的查询中使用字符串。我想使用变量名。因为我不想在查询中硬编码字符串。我可以在查询中使用变量名而不是字符串吗?如果是,那我该怎么做呢?我在网上找不到解决问题的办法。谢谢。