Commit e5b3076f authored by houyun's avatar houyun
Browse files

minor improvement

parent a5d75218
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -377,10 +377,10 @@ regex_select <- function(prefix = NULL,
      }))]
      data[id, , drop = FALSE]
    } else {
      id <- names(data)[Reduce("|", lapply(regex, function(.regex) {
        grepl(pattern = .regex, x = names(data), ...)
      id <- colnames(data)[Reduce("|", lapply(regex, function(.regex) {
        grepl(pattern = .regex, x = colnames(data), ...)
      }))]
      data[id]
      data[, id, drop = FALSE]
    }
  }
}
+4 −1
Original line number Diff line number Diff line
@@ -150,7 +150,10 @@ split_by_group <- function(data, group) {
          }
          out[[ii]] <- regex_select(regex = g, byrow = TRUE)(data)
        } else {
          out[[ii]] <- data[rownames(data) %in% g, , drop = FALSE]
          if (nm[ii] == "") {
            nm[ii] <- paste_with_na(g, collapse = "-")
          }
          out[[ii]] <- regex_select(regex = g, byrow = TRUE)(data)
        }
      }
    }