Hi Stringr Tidyverse
I have to create delimited quoted strings for filtering in query writing.
I have a number of DRG (diagnosis related groups) to put as criteria.
SQL needs them as delimited quoted strings as in dplyr and many of R packages.
For example,
WHERE
CostingDataset_Encounter.CostingDataset_Id IN (38)
--(4, 11, 12, 16, 18, 20, 21, 26))
AND
Ref_Drg.Code in ('h09z', 'h08a', 'h08b', 'h08c') where comma is needed among quoted strings.
It is not hard for hard coding for a few but will be really time consuming.
I tried the following base R paste0() but there are no comma among quoted strings.
States_Abb_20<-c("AK", "AL", "AR", "AS", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "GU", "HI", "IA", "ID", "IL", "IN", "KS", "KY")
df3<-data.frame(States_Abb_20)
df3
df3$States_Abb_20<-paste0("'",df3$States_Abb_20,"'")
df3
I hope stringr will be able to help.
Thank you.