Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCall prints R output to command line when calling R package #286

Closed
gtollefson opened this issue Dec 18, 2018 · 5 comments
Closed

RCall prints R output to command line when calling R package #286

gtollefson opened this issue Dec 18, 2018 · 5 comments

Comments

@gtollefson
Copy link

gtollefson commented Dec 18, 2018

Is it possible to suppress printing the text from the R command line REPL when calling an R package from Julia? I'm using RCall in a Julia command line tool and the printed text is a little messy.

@randy3k
Copy link
Member

randy3k commented Dec 18, 2018

You could put a semi colon at the end to avoid printing the returned object

@gtollefson
Copy link
Author

@randy3k I'm having some trouble with this. I've tried both:

`reval("

library(heatmaply);

heatmaply(x)

")

`

and also

`reval("

library(heatmaply)

heatmaply(x)

");

`

Both do not suppress printing the returned object. Do you see anything I am doing wrong?

@Non-Contradiction
Copy link
Contributor

The way Randy suggests can suppress the returned object, so julia won't display the returned RObject. But it doesn't deal with the package startup message displayed by R.
To suppress the package startup message, you need suppressPackageStartupMessages in R, or you can use Suppressor.jl in julia. So the solution is:

julia> using RCall
 
julia> using Suppressor

julia> @suppress reval("library(heatmaply);");

or

julia> using RCall

julia> reval("suppressPackageStartupMessages(library(heatmaply))");

@randy3k
Copy link
Member

randy3k commented Dec 20, 2018

Oh, it seems that I have misunderstood OP's question.

@gtollefson
Copy link
Author

@Non-Contradiction This worked well. Sorry for the late reply. Thanks to you and @randy3k.

@palday palday closed this as completed Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants