美文网首页
[R] cat() and print()

[R] cat() and print()

作者: 木木资料馆 | 来源:发表于2018-07-31 08:35 被阅读0次

    An essential difference between cat and print is the class of the object they return. This difference has practical consequences for what you can do with the returned object.

    print returns a character vector:

    > print(paste("a", 100* 1:3))

     "a 100" "a 200" "a 300"

    > class(print(paste("a", 100* 1:3)))

    "a 100" "a 200" "a 300"

     "character"

    cat returns an object of class NULL:

    > cat(paste("a", 100* 1:3))

    a 100 a 200 a 300

    > class(cat(paste("a", 100* 1:3)))

    a 100 a 200 a 300

    "NULL"

    相关文章

      网友评论

          本文标题:[R] cat() and print()

          本文链接:https://www.haomeiwen.com/subject/iikcvftx.html