How do I properly nest paste() functions in R?

后端 未结 3 614
孤街浪徒
孤街浪徒 2021-01-27 00:16

Can you tell me why

paste(paste(c(\"first\", \"second\"), collapse=\", \"), \"third\", collapse=\" and \")

gives me

\"first,          


        
3条回答
  •  佛祖请我去吃肉
    2021-01-27 00:55

    Or use:

    paste(paste(c("first", "second"), collapse=", "), "third", sep=", and ")
    ## "first, second, and third"
    

    And see this blog post on pasting: http://trinkerrstuff.wordpress.com/2013/09/15/paste-paste0-and-sprintf-2/

提交回复
热议问题