Question: How can I redirect R's output from the console to a file
1
gravatar for cristian
2.0 years ago by
cristian220
cristian220 wrote:

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.

r output rsubread redirection • 586 views
ADD COMMENTlink modified 2.0 years ago by WouterDeCoster38k • written 2.0 years ago by cristian220
2

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

ADD REPLYlink modified 2.0 years ago • written 2.0 years ago by Medhat8.2k

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

ADD REPLYlink written 2.0 years ago by cristian220
5
gravatar for 5heikki
2.0 years ago by
5heikki8.4k
Finland
5heikki8.4k wrote:
sink("yourOutput.txt")
your stuff
sink()
ADD COMMENTlink modified 2.0 years ago • written 2.0 years ago by 5heikki8.4k

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

ADD REPLYlink written 2.0 years ago by cristian220
1

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

ADD REPLYlink written 2.0 years ago by WouterDeCoster38k

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

ADD REPLYlink written 2.0 years ago by cristian220
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 676 users visited in the last hour