Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
RMySQL 経由でデータベースに接続する R スクリプトをいくつか書きました - 簡単にするために: MySQL クエリで日付を変数として設定することは可能ですか?
例えば
x<-"2012-12-01" rs <- dbGetQuery(db,"**** where date between 'x' and '2012-12-31'")
可能性はありますか、それとも "" のすべてが MySQL のものだけですか? ありがとう!
pasteクエリを動的に記述するために使用します。
paste
x<-'2012-12-01' query <- paste("**** where date between '",x,"' and '2012-12-31'",sep='')
これにより、次のようなクエリが作成されます。
"**** where date between '2012-12-01' and '2012-12-31'"
それで
rs <- dbGetQuery(db,query)