Rename fails in Sparklyr, think it depends on verison of dplyr. Definitely seeing it in the dev version of dplyr as of 5-14-2017. Confirmed it works properly for dplyr 0.5.0.
Submitted as Sparklyr
issue 678 and dplyr
issue 2776.
# devtools::install_github("tidyverse/dplyr")
# devtools::install_github('tidyverse/dbplyr')
suppressPackageStartupMessages(library('dplyr'))
packageVersion("dplyr")
## [1] '0.5.0.9004'
library('sparklyr')
packageVersion("sparklyr")
## [1] '0.5.4'
if(requireNamespace("dbplyr", quietly = TRUE)) {
packageVersion("dbplyr")
}
## [1] '0.0.0.9001'
R.Version()$version.string
## [1] "R version 3.4.0 (2017-04-21)"
dLocal <- data.frame(x = 1:2,
origCol = c('a', 'b'),
stringsAsFactors = FALSE)
sc <- sparklyr::spark_connect(version='2.0.2',
master = "local")
d <- copy_to(sc, dLocal, 'd')
# works
rename(dLocal, x2 = x, origCol2 = origCol)
## x2 origCol2
## 1 1 a
## 2 2 b
# throws
rename(d, x2 = x, origCol2 = origCol)
## Source: lazy query [?? x 2]
## Database: spark_connection
## Error in names(select)[match(old_vars, vars)] <- new_vars: NAs are not allowed in subscripted assignments
spark_disconnect(sc)
rm(list=ls())
gc(verbose = FALSE)
## used (Mb) gc trigger (Mb) max used (Mb)
## Ncells 673122 36.0 1168576 62.5 940480 50.3
## Vcells 1157466 8.9 2060183 15.8 1364787 10.5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.