library(tidyr)
library(rlang)
data(mtcars)
cols <- 3:5
gather(mtcars, key = "key", value = "value", 3:5)
#> Error in melt_dataframe(data, id_idx - 1L, gather_idx - 1L, as.character(key_var), : Objekt '_tidyr_melt_dataframe' nicht gefunden
gather(mtcars, key = "key", value = "value", !! cols)
#> Error in melt_dataframe(data, id_idx - 1L, gather_idx - 1L, as.character(key_var), : Objekt '_tidyr_melt_dataframe' nicht gefunden
other attached packages:
[1] reprex_0.1.1 tidyr_0.7.0 rlang_0.1.1
Could you reinstall tidyr please. If the error persists could you also post your devtools::session_info()
.
Apparently there's an issue on Windows if you install a package from source and that package is already loaded. In that case the installer may fail to copy over the loaded DLL.
Could you try reinstalling tidyr on a fresh session of R please?
Ok, I'll try this. Unfortunately, I can't check this before 19th August, due to holiday.
I have a similar experience. I have plenty of code that made reference to column by position, i.e.
total_budget = rowSums(.[ ,c(3:(ncol(.)-1)) ], na.rm=T)
or gather ( location, values, 3:ncol(.))
.
I get a spurious error code
Error in ncol(.) : could not find function "ncol"
This effect a lot of code that had been working with earlier versions of tidyr. I assume that because there were changes in evaluation, this may cause the problem.
Session info -----------------------------------------------------------------------
setting value
version R version 3.4.1 (2017-06-30)
system x86_64, mingw32
ui RStudio (1.0.153)
language (EN)
collate English_United States.1252
tz Europe/Prague
date 2017-08-18
Packages ---------------------------------------------------------------------------
package * version date source
acepack 1.4.1 2016-10-29 CRAN (R 3.4.1)
assertthat 0.2.0 2017-04-11 CRAN (R 3.4.1)
backports 1.1.0 2017-05-22 CRAN (R 3.4.0)
base * 3.4.1 2017-06-30 local
base64enc 0.1-3 2015-07-28 CRAN (R 3.4.0)
bindr 0.1 2016-11-13 CRAN (R 3.4.1)
bindrcpp * 0.2 2017-06-17 CRAN (R 3.4.1)
checkmate 1.8.3 2017-07-03 CRAN (R 3.4.1)
cluster 2.0.6 2017-03-10 CRAN (R 3.4.1)
colorspace 1.3-2 2016-12-14 CRAN (R 3.4.1)
compiler 3.4.1 2017-06-30 local
data.table 1.10.4 2017-02-01 CRAN (R 3.4.0)
datasets * 3.4.1 2017-06-30 local
devtools 1.13.3 2017-08-02 CRAN (R 3.4.1)
digest 0.6.12 2017-01-27 CRAN (R 3.4.1)
dplyr * 0.7.2 2017-07-20 CRAN (R 3.4.1)
extremevalues * 2.3.2 2016-01-20 CRAN (R 3.4.1)
forcats 0.2.0 2017-01-23 CRAN (R 3.4.1)
foreign 0.8-69 2017-06-22 CRAN (R 3.4.1)
Formula 1.2-2 2017-07-10 CRAN (R 3.4.1)
ggplot2 * 2.2.1 2016-12-30 CRAN (R 3.4.1)
glue 1.1.1 2017-06-21 CRAN (R 3.4.1)
graphics * 3.4.1 2017-06-30 local
grDevices * 3.4.1 2017-06-30 local
grid 3.4.1 2017-06-30 local
gridExtra 2.2.1 2016-02-29 CRAN (R 3.4.1)
gtable 0.2.0 2016-02-26 CRAN (R 3.4.1)
gWidgets 0.0-54 2014-08-28 CRAN (R 3.4.1)
gWidgetstcltk 0.0-55 2014-07-20 CRAN (R 3.4.1)
Hmisc 4.0-3 2017-05-02 CRAN (R 3.4.1)
htmlTable 1.9 2017-01-26 CRAN (R 3.4.1)
htmltools 0.3.6 2017-04-28 CRAN (R 3.4.1)
htmlwidgets 0.9 2017-07-10 CRAN (R 3.4.1)
knitr 1.17 2017-08-10 CRAN (R 3.4.1)
labeling 0.3 2014-08-23 CRAN (R 3.4.0)
lattice 0.20-35 2017-03-25 CRAN (R 3.4.1)
latticeExtra 0.6-28 2016-02-09 CRAN (R 3.4.1)
lazyeval 0.2.0 2016-06-12 CRAN (R 3.4.1)
magrittr 1.5 2014-11-22 CRAN (R 3.4.1)
Matrix 1.2-10 2017-05-03 CRAN (R 3.4.1)
memoise 1.1.0 2017-04-21 CRAN (R 3.4.1)
methods * 3.4.1 2017-06-30 local
munsell 0.4.3 2016-02-13 CRAN (R 3.4.1)
nnet 7.3-12 2016-02-02 CRAN (R 3.4.1)
pkgconfig 2.0.1 2017-03-21 CRAN (R 3.4.1)
plyr 1.8.4 2016-06-08 CRAN (R 3.4.1)
purrr 0.2.3 2017-08-02 CRAN (R 3.4.1)
R6 2.2.2 2017-06-17 CRAN (R 3.4.1)
RColorBrewer 1.1-2 2014-12-07 CRAN (R 3.4.0)
Rcpp 0.12.12 2017-07-15 CRAN (R 3.4.1)
rlang 0.1.2 2017-08-09 CRAN (R 3.4.1)
rpart 4.1-11 2017-03-13 CRAN (R 3.4.1)
scales * 0.4.1 2016-11-09 CRAN (R 3.4.1)
splines 3.4.1 2017-06-30 local
stats * 3.4.1 2017-06-30 local
stringi 1.1.5 2017-04-07 CRAN (R 3.4.0)
stringr 1.2.0 2017-02-18 CRAN (R 3.4.1)
survival 2.41-3 2017-04-04 CRAN (R 3.4.1)
tcltk 3.4.1 2017-06-30 local
tibble 1.3.3 2017-05-28 CRAN (R 3.4.1)
tidyr * 0.7.0 2017-08-16 CRAN (R 3.4.1)
tidyselect 0.1.1 2017-07-24 CRAN (R 3.4.1)
tools 3.4.1 2017-06-30 local
utils * 3.4.1 2017-06-30 local
withr 2.0.0 2017-07-28 CRAN (R 3.4.1)
@antaldaniel
This new behaviour is explained in the NEWS file and in the blog post: http://www.tidyverse.org/articles/2017/08/tidyr-0.7.0/
Thank you very much! I think this is a really big issue, because in my case I have to review at least 5000 lines of code. Since this is a very major difference, I think the error message should be more verbose, adding maybe a link to this article. It was easy to find out that this is an evaluation issue, yet the error referring to ncol () is not particularly helpful. Thanks again for pointing me to the solution.
Yes this is planned for the next tidyselect version. I just added an issue: https://github.com/tidyverse/tidyselect/issues/23
Apparently there's an issue on Windows if you install a package from source and that package is already loaded. In that case the installer may fail to copy over the loaded DLL.
Could you try reinstalling tidyr on a fresh session of R please?
This resolved the issue for me. Thank you!
Most helpful comment
Apparently there's an issue on Windows if you install a package from source and that package is already loaded. In that case the installer may fail to copy over the loaded DLL.
Could you try reinstalling tidyr on a fresh session of R please?