Unable to install ggplot2

Hi, I am trying to install ggplot2 package, however, it gives error. I think this error should be connected to the space in the file location name.

  • installing source package 'ggplot2' ...
    ** package 'ggplot2' successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error: unexpected symbol in "setwd('C:/Users/GIO'SL"
    Execution halted
    ERROR: lazy loading failed for package 'ggplot2'
  • removing 'C:/Users/Gio's Laptop/Documents/R/win-library/3.6/ggplot2'
    Warning in install.packages :
    installation of package ‘ggplot2’ had non-zero exit status

Maybe anyone could help me?

You are totally right, R doesn't like empty spaces on Windows user names. Try installing into the system-wide package library instead (You need to run RStudio as Administrator for this to work)

# Modify the path accordingly with your own R version
install.packages("ggplot2", lib = "C:\\Program Files\\R\\R-3.6.3\\library")

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.