R Studio 설치 후, package 설치 시
would you like to create a personal library 'C:/User/??/Documents/R/win-library/3.5 to install packages into
와 같은 오류가 떴다.
Yes를 눌러도 무한 반복...
예측을 해보자면, ?? 부분이 한글이라 인식을 못하는 듯 하다.
해결 방법은 다음과 같다.
Rprofile.site 설정하기
.libPaths()로 원하는 library 폴더를 추가해주는 방법도 있지만, 이는 R Studio를 실행할 때 마다 설정해줘야하는 번거로움이 있었다.
때문에 내가 찾은 방법은
C:\Program Files\R\R-4.0.4\etc
에 있는 Rprofile.site 라는 파일을 열어준다.
내용은 다음과 같을 것이다.
# Things you might want to change
# options(papersize="a4")
# options(editor="notepad")
# options(pager="internal")
# set the default help type
# options(help_type="text")
options(help_type="html")
# set a site library
# .Library.site <- file.path(chartr("\\", "/", R.home()), "site-library")
# set a CRAN mirror
# local({r <- getOption("repos")
# r["CRAN"] <- "http://my.local.cran"
# options(repos=r)})
# Give a fortune cookie, but only to interactive sessions
# (This would need the fortunes package to be installed.)
# if (interactive())
# fortunes::fortune()
이 파일 맨 마지막 줄에 다음과 같은 문장을 넣어주면 된다.
.libPaths("C://본인이 원하는 경로//library")
.libPaths를 .libpaths로 쓰는 것을 주의한다...(실제로 대소문자를 잘못 써서 고생했다)
이제, 저장 후 R studio를 재실행하고, .libPaths()로 설정이 제대로 되었는지 확인한다.
다음과 같이 나온다면 설정이 제대로 된 것이다.
tools > Install Packages 도 문제 없이 실행되는 것을 볼 수 있다.
'데이터 사이언스 > R' 카테고리의 다른 글
[Mac] 그래프 한글 깨짐 현상 (0) | 2022.05.30 |
---|