在新版本的 dplyr 中,我重构了大量代码并删除了现已退休或弃用的函数。我有一个功能如下:
\nprocessingAggregatedLoad <- function (df) {\n defined <- ls()\n passed <- names(as.list(match.call())[-1])\n \n if (any(!defined %in% passed)) {\n stop(paste("Missing values for the following arguments:", paste(setdiff(defined, passed), collapse=", ")))\n }\n \n df_isolated_load <- df %>% select(matches("snsr_val")) %>% mutate(global_demand = rowSums(.)) # we get isolated load\n df_isolated_load_qlty <- df %>% select(matches("qlty_good_ind")) # we get isolated quality\n df_isolated_load_qlty <- df_isolated_load_qlty %>% mutate_all(~ factor(.), colnames(df_isolated_load_qlty)) %>%\n mutate_each(funs(as.numeric(.)), colnames(df_isolated_load_qlty)) # we convert the qlty to factors and then to numeric\n df_isolated_load_qlty[df_isolated_load_qlty[]==1] <- …Run Code Online (Sandbox Code Playgroud)