'Can´t install packages even after changing library path

I tried to install the package "tidyverse" recently. It didn´t work as my default library is apparently leading into a OneDrive file. I´ve tried changing it with help of the following website (https://www.accelebrate.com/library/how-to-articles/r-rstudio-library), more precisely I did this:

> setwd("C:/Program Files/R/R-4.1.2/library")

> myPaths <- .libPaths()

> myPaths <- c(myPaths, "C:/Program Files/R/R-4.1.2/library")

> .libPaths(myPaths)

but the environment still showed the old libPath. When trying to install the package I still get the error:

unable to translate 'C:/Users/laura/OneDrive - Universit<U+FFFD>t Potsdam/Dokumente/R/win-library/4.1' to native encoding Error in install.packages : unable to translate 'C:\Users\laura\OneDrive - Universit<U+FFFD>t Potsdam\Dokumente\R\win-library\4.1' to native encoding

I´m a Beginner. Any suggestions how to fix this?

Thanks in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source