收到此错误,是否有人知道触发该错误的原因?

#### sc is a spark connection

require(dplyr)
require(tidyr)
require(tibble)
require(sparklyr)
require(ggplot2)
require(scales)
require(DBI)
require(lubridate)


set.seed(.111)

my_df <- data.frame(test_col = sample(letters, 10, replace = FALSE))

my_spark_df <- copy_to(sc, my_df, overwrite = TRUE)

my_spark_df

# Source: spark<my_df> [?? x 1]
# test_col
# <chr>
# 1 x
# 2 g
# 3 i
# 4 n
# 5 t
# 6 e
# 7 r
# 8 v
# 9 l
# 10 k


my_spark_df %>% mutate(test_col = toupper(test_col))

#
# Error in switch_lang(call, inlined = , namespaced = ,
#                      recursive = eval_bare(call,  : could not find function "switch_lang"

这是引用
traceback()

#
# 19: lang_partial_eval(call, vars, env)
# 18: switch_type(call, `NULL` = NULL, symbol = sym_partial_eval(call,
#                                                                vars, env), language = lang_partial_eval(call, vars, env),
#                 logical = , integer = , double = , complex = , string = ,
#                 character = call, formula = {
#                   f_rhs(call) <- partial_eval(f_rhs(call), vars, f_env(call))
#                   if (length(call) == 3) {
#                     f_lhs(call) <- partial_eval(f_lhs(call), vars, f_env(call))
#                   }
#                   call
#                 }, list = {
#                   if (inherits(call, "lazy_dots")) {
#                     call <- dplyr:::compat_lazy_dots(call, env)
#                   }
#                   map(call, partial_eval, vars = vars, env = env)
#                 }, abort(glue("Unknown input type: ", class(call))))
# 17: partial_eval(f_rhs(call), vars, f_env(call))
# 16: switch_type(call, `NULL` = NULL, symbol = sym_partial_eval(call,
#                                                                vars, env), language = lang_partial_eval(call, vars, env),
#                 logical = , integer = , double = , complex = , string = ,
#                 character = call, formula = {
#                   f_rhs(call) <- partial_eval(f_rhs(call), vars, f_env(call))
#                   if (length(call) == 3) {
#                     f_lhs(call) <- partial_eval(f_lhs(call), vars, f_env(call))
#                   }
#                   call
#                 }, list = {
#                   if (inherits(call, "lazy_dots")) {
#                     call <- dplyr:::compat_lazy_dots(call, env)
#                   }
#                   map(call, partial_eval, vars = vars, env = env)
#                 }, abort(glue("Unknown input type: ", class(call))))
# 15: FUN(X[[i]], ...)
# 14: lapply(.x, .f, ...)
# 13: map(call, partial_eval, vars = vars, env = env)
# 12: switch_type(call, `NULL` = NULL, symbol = sym_partial_eval(call,
#                                                                vars, env), language = lang_partial_eval(call, vars, env),
#                 logical = , integer = , double = , complex = , string = ,
#                 character = call, formula = {
#                   f_rhs(call) <- partial_eval(f_rhs(call), vars, f_env(call))
#                   if (length(call) == 3) {
#                     f_lhs(call) <- partial_eval(f_lhs(call), vars, f_env(call))
#                   }
#                   call
#                 }, list = {
#                   if (inherits(call, "lazy_dots")) {
#                     call <- dplyr:::compat_lazy_dots(call, env)
#                   }
#                   map(call, partial_eval, vars = vars, env = env)
#                 }, abort(glue("Unknown input type: ", class(call))))
# 11: partial_eval(dots, vars = op_vars(.data))
# 10: mutate.tbl_lazy(., test_col = toupper(test_col))
# 9: mutate(., test_col = toupper(test_col))
# 8: function_list[[k]](value)
# 7: withVisible(function_list[[k]](value))
# 6: freduce(value, `_function_list`)
# 5: `_fseq`(`_lhs`)
# 4: eval(quote(`_fseq`(`_lhs`)), env, env)
# 3: eval(quote(`_fseq`(`_lhs`)), env, env)
# 2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
# 1: my_spark_df %>% mutate(test_col = toupper(test_col))

这是 session 信息
sessionInfo()


#
#
# R version 3.4.1 (2017-06-30)
# Platform: x86_64-redhat-linux-gnu (64-bit)
# Running under: Amazon Linux AMI 2018.03
#
# Matrix products: default
# BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
#
# locale:
# [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8
# [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
# [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C
# [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#
# attached base packages:
#   [1] stats     graphics  grDevices utils     datasets  methods   base
#
# other attached packages:
# [1] lubridate_1.7.4 DBI_1.0.0       scales_1.0.0    ggplot2_3.2.0   sparklyr_1.0.0  tibble_2.1.3
# [7] tidyr_0.8.3     dplyr_0.8.1
#
# loaded via a namespace (and not attached):
# [1] Rcpp_1.0.1       pillar_1.4.2     compiler_3.4.1   dbplyr_1.2.1     r2d3_0.2.3       base64enc_0.1-3
# [7] tools_3.4.1      zeallot_0.1.0    digest_0.6.15    jsonlite_1.5     gtable_0.3.0     pkgconfig_2.0.2
# [13] rlang_0.4.0      cli_1.0.0        rstudioapi_0.7   parallel_3.4.1   yaml_2.1.19      stringr_1.3.1
# [19] withr_2.1.2      httr_1.3.1       vctrs_0.1.0      generics_0.0.2   htmlwidgets_1.3  rprojroot_1.3-2
# [25] grid_3.4.1       tidyselect_0.2.5 glue_1.3.1       forge_0.2.0      R6_2.4.0         fansi_0.4.0
# [31] purrr_0.2.5      magrittr_1.5     backports_1.1.2  htmltools_0.3.6  ellipsis_0.1.0   assertthat_0.2.1
# [37] colorspace_1.4-1 config_0.3       utf8_1.1.4       stringi_1.2.3    openssl_1.0.1    lazyeval_0.2.1
# [43] munsell_0.5.0    crayon_1.3.4

最佳答案

switch_lang()已存档在 rlang 0.4 中。您需要一个previous version

关于r - 找不到函数 "switch_lang",我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56840015/

10-10 14:30