Can't run R Markdown and failed to install required packages


I can't open RMarkdown and failed to install required packages after clicking "New file-R markdown". The error message as below. The issue is still happening after reinstallation.Pls help advise the solution , thank you.

Error writing code to file C:/Users/�û�/AppData/Local/Temp/aa86-1cb1-d69d-2b23: system error 3 (ϵͳ�Ҳ���ָ����·����)
Error in file(filename, "r") : cannot open the connection
Calls: sourceWithProgress -> parse -> file
In addition: Warning message:
In file(filename, "r") :
cannot open file 'C:/Users/???/AppData/Local/Temp/aa86-1cb1-d69d-2b23': Invalid argument
Execution halted


Does your user name contain non-ASCII characters or empty spaces? R has problems with non-ASCII characters in the package library folder.

You can change the default library folder by setting your R_LIBS_SITE environmental variable on a .Reviron or .Rprofile file

# In a .Renviron file you can set it by adding this line
R_LIBS_SITE="C:\\Program Files\\R\\R-4.0.5\\library"

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

Hi andresrcs,

Thanks for your reply, but I still can't find where is Renviron file to add the line given.Pls help provide me steps in more detail as I am a beginner without knowing much about these concepts .

It doesn't exist by default, you have to create a file with that name, for more details please click on the link I gave you before and read the blog post.

Hi Andresrcs,

I still not sure how to create that file after reading the blog. I downloaded those packages manually and can create rmarkdown but it shows error after knit. Do u have a simply way to solve it? Pls help provide detailed steps and screenshots. Thank you.

:pencil2: For more information about R startup files, you can read the following support article.

This topic was automatically closed 21 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.