我有两个系统。
以下代码在System A
上传递,但在System B
上传递。
responses <- data.frame(a = c(0,1,2,3,4),b = c(0,1,2,3,4))
section_vars <- c("a","b")
mutate_each(responses, funs(mean),one_of(section_vars)) %>%
mutate(col1 =
rowSums(
select(.,one_of(section_vars)),
na.rm = TRUE
) %>% as.integer()
) %>% .$col1
失败并显示错误:
Error "." not found
系统A(工作):
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04 LTS
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dataBroker_1.141.0.0 dplyr_0.5.0 tidyr_0.5.1
[4] data.table_1.9.6 RMySQL_0.10.9 DBI_0.4-1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 codetools_0.2-14 withr_1.0.2 digest_0.6.9
[5] psych_1.6.6 foreach_1.4.3 assertthat_0.1 plyr_1.8.4
[9] chron_2.3-47 R6_2.1.2 magrittr_1.5 lazyeval_0.2.0
[13] doParallel_1.0.10 devtools_1.12.0 iterators_1.0.8 tools_3.2.3
[17] parallel_3.2.3 yaml_2.1.13 mnormt_1.5-4 memoise_1.0.0
[21] tibble_1.0
系统B(错误):
R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dataBroker_1.141.0.2 dplyr_0.5.0 tidyr_0.5.1 data.table_1.9.6 RMySQL_0.9-3 DBI_0.3.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.4 codetools_0.2-14 psych_1.4.8.11 foreach_1.4.2 assertthat_0.1 plyr_1.8.1 chron_2.3-47 R6_2.1.2 magrittr_1.0.1 lazyeval_0.1.10 doParallel_1.0.8
[12] iterators_1.0.7 tools_3.2.5 yaml_2.1.13 parallel_3.2.5
答案 0 :(得分:1)
%>%
运算符来自magrittr
包,因此请确保您的magrittr
版本是最新的。