Issue with dbplyr::spread() on tbl_sql

Deadly 提交于 2019-12-08 07:20:40

问题


This is a specific issue of the following dev version of dbplyr:

devtools::install_github("tidyverse/dbplyr", ref = devtools::github_pull(72)) developed by @edgararuiz

It seems to me that the spread function doesn't work properly...

df_sample <- tribble(~group1, ~group2, ~group3, ~identifier, ~value, 
                      8, 24, 6, 'mt_0', 
                      12, 18, 24, 6, 'mt_1', 4)

con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
df_db <- copy_to(con, df_sample, 'df_sample')

I obtained an incorrect result with the following command. There should've been only one row of data after spread.

df_db %>% spread(identifier, value)

The result is correct if the original data is downloaded to local memory.

df_db %>% collect() %>% spread(identifier, value)

Anybody has any idea? Also, I am not sure how I can reach @edgarauiz. Appreciate it if somebody could let him know. Thanks!


回答1:


I just port this over to GitHub. Will let the author handle this.



来源:https://stackoverflow.com/questions/52750199/issue-with-dbplyrspread-on-tbl-sql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!