In R, a user has a list like the following and he wants to print this list to a text file.How to do that?
print(head(mylist,2)) [[1]] [1] 2349 103 411 9321 4268 [[2]] [1] 16937 162 For printing all the elements of a list given to a text file, we can perform lapply() function to pass into a list and append into a text file as an output such as lapply(mylist, write, "outputfile.txt",append=TRUE, ncolumns=1000)
Answered Dec 2, 2019 · 990 Views Read answer →