Getting r error 4 in R 3.4.4

Hi
Can any body help me on this ?

> par(mar = rep(2, 4))
Error in RStudioGD() : 
  Shadow graphics device error: r error 4 (R code execution error)
> capabilities()
       jpeg         png        tiff       tcltk         X11        aqua    http/ftp     sockets      libxml        fifo      cledit       iconv         NLS     profmem       cairo 
      FALSE       FALSE       FALSE        TRUE       FALSE       FALSE        TRUE        TRUE        TRUE        TRUE       FALSE        TRUE        TRUE        TRUE       FALSE 
        ICU long.double     libcurl 
       TRUE        TRUE        TRUE

Hi there - it looks to me like your version of R does not have support for some graphics types, such as jpeg and png. Do you have the cairo package installed? If not, try

install.packages("cairo")
library(cairo)

If this doesn't help, I'll also mention that R 3.4.4 is old - the current version is 3.5.1, so unless you have a compelling reason not to upgrade, upgrading to 3.5.1 may be a solution for you.

Hi km,

i tried to install.packages("cairo")

install.packages("Cairo")
Installing package into ‘/home/s00grp/s00pkg/R/x86_64-redhat-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.mtu.edu/src/contrib/Cairo_1.5-9.tar.gz'
Content type 'application/x-gzip' length 86982 bytes (84 KB)
==================================================
downloaded 84 KB

* installing *source* package ‘Cairo’ ...
** package ‘Cairo’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -m64 -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -m64 -std=gnu99 accepts -g... yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -m64 -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for pkg-config... /usr/bin/pkg-config
checking whether pkg-config knows about cairo... no
configure: CAIRO_LIBS is unset, attempting to guess it.
configure: CAIRO_CFLAGS=
checking if R was compiled with the RConn patch... no
checking cairo.h usability... no
checking cairo.h presence... no
checking for cairo.h... no
configure: error: Cannot find cairo.h! Please install cairo (http://www.cairographics.org/) and/or set CAIRO_CFLAGS/LIBS correspondingly.
ERROR: configuration failed for package ‘Cairo’
* removing ‘/home/s00grp/s00pkg/R/x86_64-redhat-linux-gnu-library/3.4/Cairo’
Warning in install.packages :
  installation of package ‘Cairo’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpncPzoi/downloaded_packages’