This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can I redirect R's output from the console to a file

Dear all,

I am running this command:

Rsubread::buildindex(basename='output/genome/ref/index/subread/celegans',reference="output/genome/ref/seq/celegans.fa")

to build an index for the C. elegans genome. R then outputs lots of interesting information to the console.

Do you know how I can redirect that output to a file?

Thanks.

C.

rsubread redirection r output

If you are running this in some R environment I think sink() function will do that read here

Thanks, it worked. I didn't know about this function!

1 answer

sink("yourOutput.txt")
your stuff
sink()

Thanks, it worked. I didn't know about this function!

If this answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.

Done. Thanks. I had upvoted it but I had not accepted it. I didn't know about accepting.

Log in to answer this question.