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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -