paste quotation marks into character string, within a loop

后端 未结 1 1380
花落未央
花落未央 2020-11-30 05:40

Using R, I want to produce multiple character strings such as:

\"modelCheck(\"var1_d.bug\")\"  
\"modelCheck(\"var2_d.bug\")\"  
...  
\"modelCheck(\"var10_d         


        
相关标签:
1条回答
  • 2020-11-30 06:32

    Simply escape the quotation marks with backslashes:

    paste("modelCheck(var\"",i,"_d.bug\")",sep="")
    

    An alternative is to use single quotes to enclose the string:

    paste('modelCheck(var"',i,'_d.bug")',sep="")
    
    0 讨论(0)
提交回复
热议问题