You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if it's possible (or possible to add as a feature) to use @rsubset with regex? It would be incredibly helpful for my workflow where I often stack DataFrames with similar variable names i.e. they share characters and I want to subset them all based on a pattern. I appreciate that it is possible to do this with @select before stacking, but there are times where it would be useful to apply this directly to the long dataframe.
MWE below.
using DataFrames, DataFramesMeta
wide_df = DataFrame(
S_L = rand(100),
S_M = rand(100),
S_H = rand(100),
I_L = rand(100),
I_M = rand(100),
I_H = rand(100),
R_L = rand(100),
R_M = rand(100),
R_H = rand(100)
)
long_df = stack(wide_df, variable_name = :state, value_name = :proportion)
let
y = $(r"R") #or y = Set([$(r"R")])
@rsubset long_df :state in y #or :state == $(r"R")
end
The text was updated successfully, but these errors were encountered:
I was wondering if it's possible (or possible to add as a feature) to use
@rsubset
with regex? It would be incredibly helpful for my workflow where I often stack DataFrames with similar variable names i.e. they share characters and I want to subset them all based on a pattern. I appreciate that it is possible to do this with@select
before stacking, but there are times where it would be useful to apply this directly to the long dataframe.MWE below.
The text was updated successfully, but these errors were encountered: