문제

I have created a table output and connected to database through RMySQL, and now I need to add index to the table, I searched around but didn't found what I need in R language, please help.

A small example of the table would look like this:

mth <- c(rep(1:2,5))  
day <- c(rep(10,5),rep(11,5))  
hr <- c(3,4,5,6,7,3,4,5,6,7)  
v <- c(3,4,5,4,3,3,4,5,4,3)  
A <- data.frame(cbind(mth,day,hr,v))   

The index I need should include: "mth" + "day" + "hr". Thank you very much!

도움이 되었습니까?

해결책

You can use dbSendQuery to send SQL statements to the server. So you can create your table and/or add indices using SQL, and afterwards write your data using dbWriteTable with append=TRUE.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top