> name<-c(rep('张三',1,3),rep('李四',3))
> subject<-c('数学','语文','英语','数学','语文','英语')
> score<-c(89,80,70,90,70,80)
> stuid<-c(1,1,1,2,2,2)
> stuscore<-data.frame(name,subject,score,stuid)
> library(sqldf)
> sqldf('select name,sum(score) as allscore from stuscore group by name order by allscore')
错误: Table stuscore exists in database, and both overwrite and append are FALSE
> stuscore
name subject score stuid
1 张三 数学 89 1
2 张三 语文 80 1
3 张三 英语 70 1
4 李四 数学 90 2
5 李四 语文 70 2
6 李四 英语 80 2