for(i in 1:length(tweet_list[[1]])){ print(tweet_list[[1]][i]) #tweet_idを指定してリプライを取得 sql <- paste("select text from reply where to_tweet_id = ", tweet_list[[1]][i], sqp = "") #リプライをベクトルとして格納 vec <- dbGetQuery(dbcon, sql) #ノイズを取り除く vec <- gsub("\\n","",vec) vec <- gsub("\\\"","",vec) vec <- gsub("\\\\n","",vec) vec <- gsub(",","",vec) print(vec) #データをテキストファイルに出力して保存 file <- paste("/path/to/a/folder