小编dav*_*ino的帖子

dplyr::n() 返回“错误:错误:n() 只应在数据上下文中调用”

我得到了以下代码

for (i in c(1:(ncol(df_multi_paths_cols) - 1))) {

  df_cache <- df_multi_paths_cols %>%
    select(num_range("ord_", c(i, i+1))) %>% 
    #select within dataset columns with prefix and within specific range i and i+1
    na.omit() %>% 
    # The na.omit R function removes all incomplete cases of a data object 
    # (typically of a data frame, matrix or vector).
    group_by(.dots = c(paste0("ord_", c(i, i+1)))) %>% 
    #paste=concatenate strings without separator
    #  group_by() takes an existing tbl and converts it into a grouped tbl where
    # operations are …
Run Code Online (Sandbox Code Playgroud)

r dplyr

11
推荐指数
2
解决办法
3万
查看次数

标签 统计

dplyr ×1

r ×1