[R] (quite possibly OT) Re: how to make R running on a Linux server display a plot on a Windows machine

Emmanuel Charpentier charpent at bacbuc.dyndns.org
Mon Feb 22 22:07:00 CET 2010

Dear Xin,

Le lundi 22 février 2010 à 09:53 -0800, xin wei a écrit : 
> hi, Kevin and K.Elo:
> thank you for the suggestion. Can you be more specific on these? (like how
> exactly get into x-switch or man ssh). I am totally ignorant about linux and
> SSH....:(     Memory limitation forces me to switch from windows to Linux
> cluster.....

While you may not believe it now, that is a reason for rejoicing rather
than grieving :-) Unix is a bit like sex : uncomprehensible and possibly
frightening to the young/ignorant, extremely enjoyable and almost
indispensable to the mature person ... and source of severe withdrawal
syndrome if/when it becomes unavailable (some employers have strange
ideas about the set of tools their employees are allowed to use) !
You've been warned...

Your problem seems to have (almost) nothing to do with R *per* *se*, but
with your ability to use it on a *remote* computer. This problem should
be discussed with your *local* friendly help. To the best of my
knowledge, neither the R help list nor its "members" are subsidized by
psu.edu's sponsors (Penn State, right ?) to provide basic computer use
tutoring to its students ; consequently, this list is *definitely* *NOT*
the right place for this. But ...

Nonwhistanding my own advice, I'll take the time to try to answer you,
in the (futile?) hope that future beginning students, after *reading*
the Posting Guide, following its advice and searching the list, will
find this answer, thus avoiding overloading our reading bandwith
*again*... That's also why I rephrased the "subject" of your post.

I suppose that the simplest solution (namely fitting "enough" memory on
your present Windows machine) is deemed impossible. The fun begins...

Now, to work with R, you need only a *text* connection to your server.
It is enough to use function creating graphs ... as files that you can
later display on your Windows machine. That's what ssh does : terminal
emulation (plus the ability to copy files back and forth, via scp (which
you *will* need), plus a way to create so-called tunnels and
redirections... But that's a horse on an entirely different color (an
elephant, actually:)).

If you want "real-time" graphics displayed by the R interpreter, you
need, indeed, to use the "-X" switch to ssh. but that is *not*
*enough* : your Windows machine *must* be fitted with software accepting
commands emitted by the server's R interpreter and obeying them to
actually create the image ; that is something called "an X server" (yes,
server : in this case, your windows machine offers a "displaying
service", that your R interpreter uses for displaying your graph, thus
becoming a client of your server).

Installing such a beast under Windows is (was ?) neither easy nor
(usually) cheap. There *are* free (in both meanings of this word) X
server implementations for Windows (most notoriously Cygwin/X and
Xming), but, as far as I know, none of them is "easy" to install for the
uninitiated : to do this, you must understand what you are doing, which
implies (partially) mastering the X window system, which is ...
complicated, to put it mildly. You'd better seek *informed* help around
you on this one.

I am aware of a handful of commercial implementations claiming to be
"easy to install", but canot emit any opinion of them : the price tag is
enough to give me pause...

Another option (to be discussed with your server's manager) is to
display on your Windows machine the image of a "virtual" X session
started on the server. Such a solution, which has a couple of
implementations (variants of VNC, variants of RDP) might be quite
preferable if your network connection is slow/unreliable : X eats
bandwidth like there's no tomorrow... I find VNC quite useful on the
limited-bandwith connections that I use almost daily.

But, may well be that the *simplest* solution would be to install Linux
on your own machine (dual boot for a first time...) : X is the native
windowing interface on this system, and won't have a bit of trouble
serving your R client : it comes *already* configured to do so.
Nowadays, installing Ubuntu is probably *simpler* than setting Xming|
Cygwin/X up properly. Again, seek local help to discuss this option.

The downside of this solution is that, while your machine runs Ubuntu,
it won't run Windows, thus cutting you off the Windows software you
already know, which might disrupt your workflow.

The *upside* of this solution is *also* that, while your machine runs
Ubuntu, it won't run Windows, thus cutting you off the Windows software
you already know and giving you a big incentive to try alternative,
quite possibly better, solutions. That form of accelerated weaning might
be more or less traumatic but might *enormously* boost your
understanding of your tools. After all, Unix has been compared to the
Tao for a reason... :-). If your major has anything to do with
mathematics, science or engineering|technologies, it would be smart to
at least consider this seriously.

In short, you should discuss your options (memory, X server, VNC/RDP,
Linux) with your *local* friendly help. Again, the R help list is
*definitely* *NOT* the right place for learning about the care and
feeding of computers.


					Emmanuel Charpentier
					preparing to be shot at dawn
					by the list police...

More information about the R-help mailing list