r - Insert a comma to separate in paste function -


i want display vector this: (using paste function)

("label 1", "label 2", ..., "label 7") 

however, when use paste function

paste("label", 1:7)

it cames this:

[1] "label 1"  "label 2"  "label 3"  "label 4"  "label 5"  "label 6"  "label 7"  #without "comma" between characters. 

or, trying way

paste("label", 1:7, ",")

[1] "label 1 ,"  "label 2 ,"  "label 3 ,"  "label 4 ,"  "label 5 ,"  "label 6 ,"  [7] "label 7 ,"   # "comma" came inside quotation marks 

what missing in paste function?

dput(paste("label", 1:7)) 

gives

c("label 1", "label 2", "label 3", "label 4", "label 5", "label 6", "label 7") 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -