I want to paste a number of arguments which vary according to a parameter, with a comma separator "," between them. For instance:
pred.size <- 2
paste(c(1:pred.size), sep=",")
results in:
##"1" "2"
while the result I want is:
##"1","2"
I want to paste a number of arguments which vary according to a parameter, with a comma separator "," between them. For instance:
pred.size <- 2
paste(c(1:pred.size), sep=",")
results in:
##"1" "2"
while the result I want is:
##"1","2"
 
    
     
    
    I think you want to paste together the elements of a vector like 1:2 to get a comma separated string. To do this you use the collapse argument of paste, since you are passing it only a single argument.
paste(1:3, collapse = ",")
[1] "1,2,3"
On the other hand if you passed multiple terms you would use sep:
paste(1, 2, 3, sep = ",")
[1] "1,2,3"
sep separates the arguments, collapse separates the components of vector arguments. For example:
paste(1:4, 5:8, collapse=",", sep="|")
[1] "1|5,2|6,3|7,4|8"
Type ?paste at the R prompt for more information.
So you want
paste(1:pred.size, collapse=",") 
Your c is not necessary because 1:pred_size is already a vector.
