[R] histogram in GNU R....

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Fri Sep 7 10:56:07 CEST 2018


On Fri, 7 Sep 2018 08:26:22 +0000
akshay kulkarni <akshay_e4 using hotmail.com> wrote:

> when I type hist(xht), it goes to the next prompt. More importantly,
> there is no error message. So, the most probable conclusion is that
> the command gets executed

Yes, hist() returns its value invisibly (try typing "? invisible" in
the R prompt without the quotes), which means that you don't see it, but
you can assign it to a variable and then view as usual:

> xht <- c(1,2,3,4,5,6,7,8,9,10)
> hxt <- hist(xht)
> hxt

You can also use the following trick:

> (hist(xht))

to see the invisible returned value without assigning it to a temporary
variable.

> But there is no pop up screen with a histogram, and nothing else...

As to why you cannot see a plot, it depends a lot on your setup. For
example, how exactly do you connect to the R instance running at AWS?
If you use plain SSH from your own Linux machine, try `ssh -X` to allow
the remote server to connect to the X graphics system on your machine
and display windows (alas, it gets very slow). What does `dev.cur()`
show after you run `hist(xht)`? On my machine, when I start R with no
available X connection, it automatically switches to the
non-interactive `pdf` graphics device; all plots get redirected to the
`Rplots.pdf` file in the current directory. Perhaps you can download
that file from the EC2 instance and view it locally?

-- 
Best regards,
Ivan




More information about the R-help mailing list