How to suppress part of the output from `lapply()`?

前端 未结 2 1723
南方客
南方客 2021-01-13 12:53

I want to use lapply() to print all the elements that I have inside of a list. The following code does that, but the output produced is strange.



        
2条回答
  •  我在风中等你
    2021-01-13 13:11

    An option is invisible

    invisible(lapply(N.seq, print))
    #[1] 1
    #[1] 2
    #[1] 3
    #[1] 4
    #[1] 5
    

    If we want to convert the vector to list,

    as.list(N.seq)
    

提交回复
热议问题