所以我跟着this blog创建了一个名为r2jekyll的可执行文件
不幸的是,我在Windows上,所以我必须以不同的方式创建名为r2jekyll的.Rexec
r2jekyll的代码在这里:
#!/usr/bin/env Rscript
library(knitr)
# Get the filename given as an argument in the shell.
args = commandArgs(TRUE)
filename = args[1]
# Check that it's a .Rmd file.
if(!grepl(".Rmd", filename)) {
stop("You must specify a .Rmd file.")
}
# Knit and place in _posts.
dir = paste0("../_posts/", Sys.Date(), "-")
output = paste0(dir, sub('.Rmd', '.md', filename))
knit(filename, output)
# Copy .png files to the images directory.
fromdir = "{{ site.url }}/images"
todir = "../images"
pics = list.files(fromdir, ".png")
pics = sapply(pics, function(x) paste(fromdir, x, sep="/"))
file.copy(pics, todir)
unlink("{{ site.url }}", recursive = TRUE)
一切正常,我可以运行我的r2jekyll rexec(感谢this blog)它运行但没有任何反应
我直到最后一步在一个名为first_test.Rmd
的文件上运行r2jekyll我在命令提示符
中运行以下代码cd (go to directory where my r2jekyll and my first_test.Rmd are sitting)
然后
r2jekyll.rexec first_test.Rmd (the blog author used this code, he is on a mac)
我收到以下错误
错误:您必须指定.Rmd文件。 执行暂停
所以我的问题是:如何让我的r2jekyll.Rexec对first_test.Rmd进行处理