#' 检查题库中试题的完整性
#' @param 试题向量 mdid=c(1,3,5),1:3
#' @return pdf and doc
#' @author lgm
#' @export
#' @examples
#' check_pdf_doc(5:6) # please not use one id
#'
check_pdf_doc <- function(idvec){
library(dplyr)
prjPath = "/Users/gabe/liguomin.teaching/Testbanks/Tests/"
setwd(prjPath)
dataDir <- paste0(prjPath,"check")
my_db <- dplyr::src_sqlite(path="/Users/gabe/liguomin.teaching/Testbanks/testbankmd.sqlite")
testbank_tb = dplyr::tbl(my_db,'testbank')
create_md <- function(id){
outname <- paste0("item-",id)
testbank_tb %>%
dplyr::filter(mdid==id) %>%
dplyr::select(content) %>%
# To pull down all the results use collect()
collect %>%
as.list %>%
unlist %>%
paste(.,collapse = "\n") %>%
cat(., file=paste0(dataDir,"/",outname,".md"))
}
sapply(idvec, create_md)
# make doc and pdf files
setwd(dataDir)
system('make pdfcheck')
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.