R-tidyverse
dplyr动词中使用外部向量
# 1. Using across(all_of())
vars <- c("gear", "carb", "am")
mtcars %>% distinct(across(all_of(vars)), .keep_all = TRUE)
# 1. unquote-splice操作符!!!
mtcars %>% distinct(!!!syms(vars), .keep_all = TRUE)
R-data.table
Julia-DataFrames
选择行
使用正则表达式
df3 = DataFrame(A=1:5,B=["ABCABCAB","ABC","AB","BB",missing])
@rsubset df3 @passmissing occursin(r"ABC", :B)
colMean
@time mean(Matrix(df_Tumour), dims=1)
@time mean.(eachrow(df_Tumour))
@time mean(Matrix(df_Tumour), dims=2) #faster