使用tidyverse或dplyr由简单的mutate投射的错误 [英] Error casted by simple mutate using tidyverse or dplyr

查看:224
本文介绍了使用tidyverse或dplyr由简单的mutate投射的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用无法调试的tidyverse软件包遇到了严重的麻烦.例如,即使在我已经制作的过去的项目中,"mutate"也无法正常工作. 当我安装以下软件包时,一切就开始了:

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)

(或library(dplyr) library(tidyr)) library(purrr))

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

当我执行rm(list=ls())时,它仍然存在.

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

我唯一没有尝试过的方法就是卸载R/RStudio并重新安装. 我使用RStudio版本1.0.153和R版本3.4.1. 我实际上试图在其他计算机上重现该错误,但这显然不起作用.

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.

这是一个临时示例:

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在我的会话中定义为OK.我希望在新的数据框架emp.data.new("RaisedSalary")中添加一个新列,而不是我得到:

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:

mutate_impl(.data,点)中的错误: 无法将对象转换为函数:[type = NULL; target = CLOSXP,SPECIALSXP或BUILTINSXP].

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

如果我加载tidyr/dplyr而不是tidyverse,我也会收到此错误消息.我在论坛上潜伏了48多个小时,但没有发现任何与该错误有关的内容.有没有人遇到这样的错误?

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?

sessionInfo()的结果:

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

推荐答案

我使用install.packages("dplyr")更新了dplyr,并且可以正常工作.除了现在,它给我警告消息说rlang现在与dplyr不兼容.仍然有效!希望他们能尽快解决不兼容问题. --- 2019/09/17

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

这篇关于使用tidyverse或dplyr由简单的mutate投射的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆