Skip to content

Instantly share code, notes, and snippets.

@haven-jeon
Last active December 10, 2015 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haven-jeon/4485043 to your computer and use it in GitHub Desktop.
Save haven-jeon/4485043 to your computer and use it in GitHub Desktop.
knitr 사용을 위한 함수
#' run like this "require(devtools);source_gist("https://gist.github.com/4485043");"
compile_pdf<- function(filename, typeset="pdflatex"){
require(knitr)
prev_enc <- getOption("encoding")
options(encoding="UTF-8")
rnw <- knit(filename, envir=new.env())
system(paste(typeset, rnw))
options(encoding=prev_enc)
}
knit_ko_win <- function(filename, ...){
require(knitr)
prev_enc <- getOption("encoding")
options(encoding="UTF-8")
rnw <- knit(filename, envir=new.env(),...)
options(encoding=prev_enc)
return(rnw)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment