Open ntuaha opened 10 years ago
options(gsubfn.engine='R'); library(sqldf) Loading required package: gsubfn Loading required package: proto Loading required package: RSQLite Loading required package: DBI Loading required package: RSQLite.extfuns tmp1 <- sqldf('select Species, Fat, count(_) as Count from siris group by Species, Fat') tmp2 <- sqldf('select Species, sum(Count) as cnt_by_species from tt group by Species') Error in sqliteExecStatement(con, statement, bind.data) : RS-DBI driver: (error in statement: no such table: tt) sqldf('select tmp1.Species, Fat, Count, (Count_1.0 / cnt_by_species) as Pct
- from tmp1 join tmp2 on tmp1.Species = tmp2.Species') -> siris_ag Error in sqliteExecStatement(con, statement, bind.data) : RS-DBI driver: (error in statement: no such table: tmp2)
tmp2 <- sqldf('select Species, sum(Count) as cnt_by_species from tt group by Species')
這邊有typo,tt應該是tmp1,會修正。
Error in [.data.frame(siris_ag, , list(Count = .N), by = "Species,Fat") :
unused argument (by = "Species,Fat")
這個錯誤我無法重製。
然後這兩頁基本上是eval=FALSE
因為只是想展示其他library可能的作法,不想因此就讓Tutorial套件得多了好幾個dependencies,所以使用者如果嘗試要跑可能會遇到沒裝library的問題。理論上走到這一步他們應該有能力自己裝套件了。
可以將套件放到DSC2014Tutorial之中的Suggests之中
Error in
[.data.frame
(siris_ag, , list(Count = .N), by = "Species,Fat") : unused argument (by = "Species,Fat")沒有這個library