If R was built without X support, you have to re-build R.
If R was built properly with X, you might want to check if your shell session allows X to work properly. Examples of problems might be forgetting to add the "-X" option when connecting using ssh, forgetting to start an X server, forgetting to pass DISPLAY environment variable to sub-session, or incorrect setting of the DISPLAY variable, etc.