How to filter data and apply specific tags in R -
i filtering lowspenders master data file called "newdata" below.
lowspenders = filter(newdata, monetary >= 0 & monetary <=91)
how i:
- create additional column in r called "segment"
- name in segment of entries of filter(newdata, monetary >= 0 & monetary <=91) lowspender?
i think dplyr
verb looking mutate
. tie in if_else
, , get:
mutate(newdata, segment = if_else(monetary >= 0 & monetary < 91, "lowspender", "not lowspender")
Comments
Post a Comment