On Sun, 26 Jan 2020 at 16:30, Felix Blind wrote:
>
> But when I put the same code in a file script.r and run it with R -f
> script.r or if I source it in the REPL with source("script.r") I do not
> get any plots shown.
>
> Can you guys tell me what I do wrong. (Apart from either using RStudio
> o
> An integrated development environment will allow you to concentrate on
> learning R
> rather on the mechanics of running R in a
> non-standard environment.
Oh my gosh...
The terminal emulator is not a non-standard environment.
__
R-help@r-project.org
Felix,
I suggest you consider using an IDE such as RStudio as you develop and run R
code. An integrated development environment will allow you to concentrate on
learning R
rather on the mechanics of running R in a
non-standard environment.
John
John David Sorkin M.D., Ph.D.
Professor of Medicine
You need to understand that the R interpreter does not have an
interactive plot device when run as a script from an OS command line.
You need to open an output device, `print` the output of the ggplot
call, and then _after_ closing the device appropriately, open the
output in an appropriate vi
Hello,
Have you tried
source("script.r", print.eval = TRUE)
?
Also, you should print() the graph explicitly:
library(ggplot2)
data(midwest, package = "ggplot2")
g <- ggplot(midwest, aes(area, poptotal)) + geom_point()
print(g)
Hope this helps,
Rui Barradas
Às 16:32 de 24/01/20, Felix Bl
Dear Felix,
> I would like to run R scripts like that: R -f script.r and still get the
> plots that pop up.
Since you are using ggplot2, you can use the ggsave function from the package
to save the plot to a location of your choice. I tested the following script
from the command line and it wor
OP does not want to depend on RStudio. Bert.
Need to open a graphics device. Which one you use is highly dependent on your
needs and OS configuration.
https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/Devices.html
On January 26, 2020 8:06:24 AM PST, Bert Gunter wrote:
>Google is you
Google is your friend!
https://stackoverflow.com/questions/26643852/ggplot-plots-in-scripts-do-not-display-in-rstudio
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip
Dear R users,
i am a python user trying to get my statistical knowledge up to speed
and R is the language for that.
I would like to run R scripts like that: R -f script.r and still get the
plots that pop up.
When I type the following code in the R REPL I get a nice plot:
library(ggplot2)
9 matches
Mail list logo