2017-12-26 33 views
1

macOS 10.12를 사용하여 터미널에서 Rmd 파일을 편직하려고합니다. 난 그냥 사제에서 R을 설치하지만, 내가하려고 할 때 다음과 같은 한 :Rmarkdown에서 라이브러리 경로를 찾을 수 없음

$ Rscript -e "rmarkdown::render('test.Rmd')" 

오류가 나타납니다

Error in loadNamespace(name) : there is no package called ‘rmarkdown’ 
Calls: :: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> 
Execution halted 

내가 하나가 라이브러리를 내 보내야한다고,이 related question에 기반을 가정하고 . 터미널에서 다음

> .libPaths() 
[1] "/Library/Frameworks/R.framework/Versions/3.3/Resources/library" 

과 :

그래서 나는 R 스튜디오에서 재판을

$ export R_LIB= usr/Library/Frameworks/R.framework/Versions/3.3/Resources/library 

하지만이 오류가 발생합니다 : 진행 방법에 대한

-bash: export: `usr/Library/Frameworks/R.framework/Versions/3.3/Resources/library': not a valid identifier 

어떤 제안 여기에서 많은 감사 할 것입니다!

+0

수출에서 슬래시가 없습니다. –

+0

'/ usr/Library/Frameworks/R.framework/Versions/3.3/Resources/library'는'.libPaths()'의 반환 값과 일치하지 않는 동일한 에러 –

+0

을 던지지 않습니다. –

답변

1

bash에서 할당 할 때 = 기호 주위에 공백을 사용할 수 없습니다. 이것은 "유효한 식별자가 아닙니다"오류의 원인입니다.

export R_LIB=usr/Library/Frameworks/R.framework/Versions/3.3/Resources/library 

은 배시 문제를 해결할 것입니다,하지만 난 당신이 usr/Library 디렉토리가 가능성 초과 찾아 당신이 R.에서 달성하려는 모르겠어요. 그것은 사용자가 있다면,

export R_LIBS=/Library/Frameworks/R.framework/Versions/3.3/Resources/library 

또는 : 찾고있을 수 있습니다 내가 당신을 의심

The library search path is initialized at startup from the environment variable R_LIBS (which should be a colon-separated list of directories at which R library trees are rooted) followed by those in environment variable R_LIBS_USER . Only directories which exist at the time will be included.

By default R_LIBS is unset, and R_LIBS_USER is set to directory ‘ R/R.version$platform-library/x.y ’ of the home directory (or ‘ Library/R/x.y/library ’ for CRAN macOS builds), for R x.y.z.

: 당신은 an environment variable은 R이 곳뿐만 아니라 R_LIBS로, 사용자 별 라이브러리를 찾기 위해 알 R_LIBS_USER라고 설정할 수 있습니다 구체적 :

export R_LIBS=$HOME/Library/Frameworks/R.framework/Versions/3.3/Resources/library