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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -