粘贴

时间:2017-08-19 14:38:32

标签: r

我在循环中使用它:

xb=paste0(xb,ar,"==",dfp,'"',"&",'"')

其中ar是"男"和dfp也是"男性" 我希望这看起来像:

"Male"=="Male"&"Male"=="Male"&"Male=="Male"

经过这一行的几次迭代 但它看起来像

"Male==Male\"&\"Male==Male\"&\"Male==Male\"

我做错了什么? 这是循环:

xb=""
  numCol=c(2,3)
   for(ar in arguments){
     print(ar)
     for(i in numCol){
       print(i)
     for(dfp in dfparam[,i]){
       print(dfp)
       #browser()
       #xb=paste0(xb,ar,"==",dfp,'"',"&",'"')
       xb=cat(xb,'"',ar,'"=="',dfp,'"'," & ")
       #xb=cat(xb,ar,'"=="',dfp," & ")
     }
     }
   }
  print(xb)

xb = cat(xb,'"',ar,'" =="',dfp,' "',"&"),我明白了:

[1] "Male"
[1] 2
[1] "Male"
 " Male "==" Male "  & [1] "Male"
 " Male "==" Male "  & [1] "Male"
 " Male "==" Male "  & [1] "Male"

0 个答案:

没有答案