Synth Problems, can´t install the package

Hello there, so I´m trying to use Syntetic Control for a project. But i have problems to download Synth Package, it tells me this:

install.packages("Synth")
Installing package into ‘C:/Users/Pablo Montero/OneDrive/Documentos/R/win-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependency ‘optimx’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/optimx_2021-10.12.zip'
Content type 'application/zip' length 843276 bytes (823 KB)
downloaded 823 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/Synth_1.1-5.zip'
Content type 'application/zip' length 136264 bytes (133 KB)
downloaded 133 KB

Error in install.packages : cannot open file 'C:/Users/Pablo Montero/OneDrive/Documentos/R/win-library/4.0/file3c8c33e01cb2/optimx/doc/Extend-optimx.pdf': Permission denied

Could you help me?

R has problems with cloud synced folders (OneDrive in this case), I would recommend setting your package library in a non synced folder. You can change the default library folder by setting your R_LIBS_SITE environmental variable on a .Reviron or .Rprofile file. For example:

# In a .Renviron file you can set it by adding a line like this one with the desired location 
R_LIBS_SITE="C:\\Program Files\\R\\R-4.1.1\\library"

For a more detailed explanation, you can read this blog post

Thank you very much. It helped me a lot.
Now I´m running the SCM and when I try to run the "dataprep" it tells me this:

"Error in dataprep(foo = basedata, predictors = c("pob", "emp", "hc", "rconna", :
unit.names.variable not found as character variable in foo."

You know why is that?? I have my panel data and everything but i don´t know why it keeps telling me that.

This is a different question, we like to keep things tidy around here so please ask it on a new topic providing a relevant reproducible example (reprex) illustrating your issue. Have a look at this guide, to see how to create one:

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.