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:

  1. create additional column in r called "segment"
  2. 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

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -