What are the differences between concatenating strings with cat and paste?

In particular, I have the following questions.

  1. Why does R not use the double quote (") when it prints the results of calling cat (but it uses quotes when using paste)?

    > cat("test")
    test
    > paste("test")
    [1] "test"
    
  2. Why do the functions length and mode, which are functions available for almost all objects in R, not "work" on cat?

    > length(cat("test"))
    test[1] 0
    > mode(cat("test"))
    test[1] "NULL"
    
  3. Why do C-style escape sequences work with cat, but not with paste?

    > cat("1)Line1\n 2)Line2\n 3)Line3")
    1)Line1
     2)Line2
     3)Line3
    > paste("1)Line1\n 2)Line2\n 3)Line3")
    [1] "1)Line1\n 2)Line2\n 3)Line3"
    
  4. Why doesn't R's recycling rule work with cat?

    > cat("Grade", c(2, 3, 4, 5))
    Grade 2 3 4 5
    > paste("Grade", c(2, 3, 4, 5))
    [1] "Grade 2" "Grade 3" "Grade 4" "Grade 5"
    
Edit
Report