6

I am having serious troubles using the tidyverse package that I cannot debug. As an example, "mutate" does not work properly even on past project I have already produced. This all started when I installed the following package:

library(pdftools)
library(tm)
library(stringi)
library(tidyverse)

(or library(dplyr) library(tidyr)) library(purrr))

And it still remains when I do a rm(list=ls()).

The only thing I haven't tried so forth is deinstalling R/RStudio and reinstalling it. I use RStudio version 1.0.153 and R version 3.4.1. I actually tried to reproduce the bug on other computers and this was obviously not working.

Here is an ad hoc example:

library(tidyverse)
emp.data <- data.frame(emp_id=c(1:5),emp_name=c("Rick","Dan","Michelle","Ryan","Gary"),
                       salary=c(623.3,515.2,611.0,729.0,843.25), 
                       start_date=as.Date(c("2012-01-01", "2013-09-23", "2014-11-15", "2014-05-11",
                         "2015-03-27"),
  stringsAsFactors = FALSE)
)
emp.data_new <- emp.data %>%
  mutate(RaisedSalary = salary*1.4)

emp.data is defined ok in my session. I would expect the addition of a new column in the new data frame emp.data.new ("RaisedSalary") and instead of this I get:

Error in mutate_impl(.data, dots) : Cannot convert object to a function: [type=NULL; target=CLOSXP, SPECIALSXP, or BUILTINSXP].

I also get this error message if I load tidyr/dplyr instead of tidyverse. I've lurked on the forum for more than 48 hours without finding anything close to this mistake. Has anyone already experienced such an error?

Outcome of sessionInfo():

R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252 LC_NUMERIC=C                   LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] wordcloud_2.6      RColorBrewer_1.1-2 SnowballC_0.6.0    bindrcpp_0.2       forcats_0.3.0      stringr_1.4.0      purrr_0.3.2        readr_1.1.1       
 [9] tibble_1.4.2       ggplot2_3.0.0      tidyverse_1.2.1    tidyr_0.8.0        dplyr_0.7.4        stringi_1.4.3      tm_0.7-6           NLP_0.2-0         
[17] pdftools_2.2       GCPM_1.2.2        

loaded via a namespace (and not attached):
 [1] qpdf_1.1           tidyselect_0.2.4   slam_0.1-45        reshape2_1.4.2     haven_1.1.1        lattice_0.20-35    colorspace_1.3-2   rlang_0.4.0       
 [9] pillar_1.2.2       foreign_0.8-69     glue_1.2.0         withr_2.1.2        modelr_0.1.1       readxl_1.1.0       bindr_0.1          plyr_1.8.4        
[17] munsell_0.5.0      gtable_0.2.0       cellranger_1.1.0   rvest_0.3.2        psych_1.8.3.3      parallel_3.4.1     broom_0.4.4        Rcpp_0.12.16      
[25] scales_1.0.0       jsonlite_1.5       RcppProgress_0.4.1 mnormt_1.5-5       askpass_1.1        hms_0.3            grid_3.4.1         cli_1.0.0         
[33] tools_3.4.1        magrittr_1.5       lazyeval_0.2.0     crayon_1.3.4       pkgconfig_2.0.1    xml2_1.1.1         lubridate_1.7.4    assertthat_0.2.0  
[41] httr_1.4.0         rstudioapi_0.7     R6_2.2.2           nlme_3.1-131       compiler_3.4.1
3
  • 2
    Your code runs fine for me. I'm definitely using much newer versions of R and RStudio, but it looks like, e.g., dplyr should work on R versions as old as 3.2. Can you add the output of sessionInfo() to your question so we can see package versions?
    – aosmith
    Jun 28, 2019 at 14:40
  • 2
    What package did you install? Is it possible that you accidentally updated your rlang package (possibly as a dependency of another package)? Or one of the other dependencies of dplyr? Jun 28, 2019 at 14:49
  • @AdamSampson To your concern: I recently installed pdftools, tm and stringi and it's highly probable that rlang has been updated alongside those installations.
    – fbm81
    Jun 30, 2019 at 0:28

2 Answers 2

Reset to default

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

2

Got this error with ver 3.5 in script that had previously worked - Updating rlang fixed issue

1
  • I also think this was the biggest issue here.
    – fbm81
    Aug 13, 2019 at 8:39
2

I updated the dplyr by using install.packages("dplyr") and it worked. Except that now it gives me warning messages that rlang is not compatible with dplyr now. Still, it worked! Hope they will sort out the incompatibility soon. --- 2019/09/17

1
  • this worked for me. it installed all the dependent packages as well like purr and rlang. no error message after
    – csheth
    Feb 29, 2020 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.