Check durability of dplyr::arrange
through dplyr::compute
.
knitr::opts_chunk$set( collapse = TRUE, comment = " # " ) options(width =100)
library('dplyr') library('RPostgreSQL') packageVersion('dplyr') packageVersion('RPostgreSQL') my_db <- dplyr::src_postgres(host = 'localhost',port = 5432,user = 'postgres',password = 'pg') class(my_db) set.seed(32525) dz <- dplyr::copy_to(my_db,data.frame(x=runif(1000)),'dz99',overwrite=TRUE)
Notice below: no warnings in frame or runtime.
dz %>% arrange(x) %>% mutate(ccol=1) %>% mutate(rank=cumsum(ccol)) -> dz1 print(dz1) warnings()
Notice below: warning "Warning: Windowed expression 'sum("ccol")' does not have explicit order.". Result may appear the same, but we do not seem to be able to depend on that.
dz %>% arrange(x) %>% compute() %>% mutate(ccol=1) %>% mutate(rank=cumsum(ccol)) -> dz2 print(dz2) warnings()
Notice below: warning "Warning: Windowed expression 'sum("ccol")' does not have explicit order.". Result may appear the same, but we do not seem to be able to depend on that.
dz %>% arrange(x) %>% collapse() %>% mutate(ccol=1) %>% mutate(rank=cumsum(ccol)) -> dz3 print(dz3) warnings()
Submitted as dplyr issue 2281.
version
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.