You could use
gsub('\n', '', select1) to remove all newlines from a string, but the better question is this: Is that really what you want to do? I think most database interfaces that are implemented in R handle newline characters just fine, just as R does. For example, if you
writeLines your string instead of printing it, it looks much better.
runinf <- "select asp_run_id as runid,asp_run_ind as runind,asp_eval_qtr as evalqtr,asp_rerun_id as rerunid,asp_rpt_qlf as qlf,"
datainf <- "pm_id as pmsid,
hco_id as hcoid,
rfi_ind_id as measid,
st_bsn_str_cd as state,
rfi_msr_set_id as msrsetid,
rfi_msr_set_cd as msrsetcd,
rfi_subset_id as rfi_subset_id,
msr_rsk_adj as radj,
jc_mop_opt_typ_cd as measuse,
expc_rt_typ as expctyp,"
select1 <- paste0(runinf, datainf)
#> select asp_run_id as runid,asp_run_ind as runind,asp_eval_qtr as evalqtr,asp_rerun_id as rerunid,asp_rpt_qlf as qlf,pm_id as pmsid,
#> hco_id as hcoid,
#> rfi_ind_id as measid,
#> st_bsn_str_cd as state,
#> rfi_msr_set_id as msrsetid,
#> rfi_msr_set_cd as msrsetcd,
#> rfi_subset_id as rfi_subset_id,
#> msr_rsk_adj as radj,
#> jc_mop_opt_typ_cd as measuse,
#> expc_rt_typ as expctyp,
Created on 2022-06-20 by the reprex package (v1.0.0)
Are you getting an issue when you pass
select1 as a query to a database?