R Notes

Difference between paste and paste0:

> (nth <- paste0(1:12, c("st", "nd", "rd", rep("th", 9))))

[1] "1st"  "2nd"  "3rd"  "4th"  "5th"  "6th"  "7th"  "8th"  "9th"  "10th"

[11] "11th" "12th"

> (nth <- paste(1:12, c("st", "nd", "rd", rep("th", 9))))

[1] "1 st"  "2 nd"  "3 rd"  "4 th"  "5 th"  "6 th"  "7 th"  "8 th"  "9 th"

[10] "10 th" "11 th" "12 th"

你可能感兴趣的:(R Notes)