Skip to content
Prev 244165 / 398506 Next

string

It took me quite some time to understand the difference between sep and 
collapse.

The examples in Phil Spector's book (2008) helped me to get it:

paste(c('X','Y'), 1:5, sep='_')
"X_1" "Y_2" "X_3" "Y_4" "X_5"
paste(c('X','Y'), 1:5, collapse='|')  ## sep=" " by default
[1] "X 1|Y 2|X 3|Y 4|X 5"
paste(c('X','Y'), 1:5, sep='_', collapse='|')
[1] "X_1|Y_2|X_3|Y_4|X_5"

Ivan

Le 12/7/2010 16:38, (Ted Harding) a ?crit :