Question: How can I redirect R's output from the console to a file
1
gravatar for cristian
3.6 years ago by
cristian250
cristian250 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 • 844 views
ADD COMMENTlink modified 3.6 years ago by WouterDeCoster44k • written 3.6 years ago by cristian250
2

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

ADD REPLYlink modified 3.6 years ago • written 3.6 years ago by Medhat8.8k

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

ADD REPLYlink written 3.6 years ago by cristian250
5
gravatar for 5heikki
3.6 years ago by
5heikki9.0k
Finland
5heikki9.0k wrote:
sink("yourOutput.txt")
your stuff
sink()
ADD COMMENTlink modified 3.6 years ago • written 3.6 years ago by 5heikki9.0k

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

ADD REPLYlink written 3.6 years ago by cristian250
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 3.6 years ago by WouterDeCoster44k

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

ADD REPLYlink written 3.6 years ago by cristian250
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: 1309 users visited in the last hour