vscode비쥬얼스튜디오 R knit markdown PDF 변환 오류 해결 방법 세 가지

내가 보기엔 knit에서 markdown을 pdf로 변환하는 과정에서

일어나는 오류는 크게 세 가지가 있는 것 같다.

  • [jd

    install

    install

  • [jd

    chunk

    chunk

  • [jd

    html -> pdf

    html -> pdf

  • [jd

    Install

    Install

    install.packages("rmarkdown", repos="http://cran.us.r-project.org")

    install.packages("knitr", repos="http://cran.us.r-project.org")

    install.packages("파일명")

    만 하면 오류가 뜨길래, 뒤에 repos="http://cran.us.r-project.org"

    를 붙여주면 install뒤에 오류가 뜨지 않는다.

    -> install.packages("파일명",repos="http://cran.us.r-project.org" ) 을 해보자

    2. R chunk 이름 오류

    chunk를 보면

    r cars1

    r cars2

    이렇게 다른 걸 알 수 있다. R작업을 하다 보면 나는 chunk를 복붙해서 chunk 이름이 같아지는 경우가 있는데,

    이때 뒤에 숫자를 붙여서 differenciate 해주면 오류가 뜨지 않는다.

    3. html

    가끔 pdf로의 변환이 안 될때 html로 변환을 먼저 하는 것도 추천한다.

    Convert HTML pages to a PDF document. Online, no installation or registration required. It's free, quick and easy to use.

    www.sejda.com

    로 가면html -> pdf 변환을 해주는데, 쉽게 할 수 있다.