R: Print list to a text file

前端 未结 8 1790
执念已碎
执念已碎 2020-11-30 21:17

I have in R a list like this:

> print(head(mylist,2))
[[1]]
[1] 234984  10354  41175 932711 426928

[[2]]
[1] 1693237   13462

Each eleme

相关标签:
8条回答
  • 2020-11-30 22:08

    Not tested, but it should work (edited after comments)

    lapply(mylist, write, "test.txt", append=TRUE, ncolumns=1000)
    
    0 讨论(0)
  • 2020-11-30 22:14

    I solve this problem by mixing the solutions above.

    sink("/Users/my/myTest.dat")
    writeLines(unlist(lapply(k, paste, collapse=" ")))
    sink()
    

    I think it works well

    0 讨论(0)
提交回复
热议问题