I'm not 100% sure if what you're doing will end up working (I haven't run the code), but, if you want to use the result of an R expression (e.g. for the date, you get the result of r Sys.Date(), you need to surround it with backticks and have an r next to the first backtick — just as you do with Sys.Date()).
I am with @mara on this one - you need to surround as you do with Sys.Date. From what you have now, this is working. However,it depends where your file lives. Where is your file compare to you working directory / RStudio Projet ?
Sometime,it is not always a good idea to let the computer decide I think the easier is to put the path of the bib files directly in YAML.
add.bib is the bibtex file I store the all references there.
pca.Rmd is the rmd file I cite some references from add.bib.
Here is my idea.
Maybe in the future, I will create an Rmd file in the deeper nodes, the relative path is a hard way to cite a reference from this bib file. Thus here::here is a good alternative.
And I find the input types are different in date and bibliography from the yaml options.
For output github_document.
The correct way to type date is "2018-11-25" or "r Sys.Date()" ,
but the input of bibliography seemmingly doesn't need " or '. I try add " or ' on the input like bibliography: "../add.bib" and I get an error.
Error in yaml::yaml.load(string, ...) :
Scanner error: while scanning for the next token at line 4, column 15 found character that cannot start any token at line 4, column 15
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load_utf8 -> <Anonymous>
停止执行
Error in yaml::yaml.load(string, ...) :
Scanner error: while scanning for the next token at line 9, column 15 found character that cannot start any token at line 9, column 15
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load_utf8 -> <Anonymous>
停止执行
That's okay! There's three things going on here, so it's a little complicated:
The outer quotes ("blah") are telling the YAML processor that this option runs all the way to the end of the line, not just to the next space;
The backticks and r (`r blah`) allow you to include R code in your YAML; and
The single quotes ('blah') are for the function argument.
The backticks are fixed—you can't use anything else for them—but if you re-use single or double quotes for more than one purpose, things get confused. If you absolutely have to nest the same kind of quotes inside each other, there are ways of escaping them, but the method of escaping characters is specific to the language, and with both R and YAML in here, it gets confusing real quick If you can, it's generally easier to use different kinds of quotes for each purpose.
It is, but the system date example doesn't have any function arguments. Since most R style guides and package documentation examples use double quotes for strings, you hit problems when you try to use them unescaped in a YAML block