How to do conditional replacement in R using "like" operator equivalent in SQL/SAS -


my data.frame has more >100 observation. below snapshot of it

   variable    bloodpressure    heartrate    residual    bloodpressure1    heartrate1    residual1    bloodpressure2    heartrate2    residual2 

i want rid of numerical parts above data.frame. new output should like

         variable          bloodpressure          heartrate          residual          bloodpressure          heartrate          residual          bloodpressure          heartrate          residual 

is there anyway can use below condition in r use in sas

 if variable "%bloodpressure%" new_variable = "bloodpressure" 

or can substring character part variable , create new_variable?

if want removed digital numbers in string, try r function $ gsub $

> gsub("\\d+","","residual1") [1] "residual" 

Comments

Popular posts from this blog

Receive udp packets in android gstreamer -

php - Extract Text from HTTP referer -

java - Callback from new thread to class from which thread was initiated -