I am getting an error in my r Markdown file that I am compiling using knitr in RStudio. I'm not really sure where this 'error' should be directed. It doesn't appear to be an 'R' error per say.
If I create an R markdown document with the following YAML header content, I can knit the file just fine:
---
title: "Eye tracking AOI plots"
author: "Steven Vannoy"
date: "`r format(Sys.time(), '%I:%M')`"
output: html_document
---
But if I merely change the single quotes inside the format statement to double quotes (which is what I was originally using),
---
title: "Eye tracking AOI plots"
author: "Steven Vannoy"
date: "`r format(Sys.time(), "%I:%M")`"
output: html_document
---
I get the following run time error:
Error in yaml::yaml.load(enc2utf8(string), ...) :
Scanner error: while scanning for the next token at line 3, column 32found character that cannot start any token at line 3, column 32
Calls: <Anonymous> ... yaml_load_utf8 -> mark_utf8 -> <Anonymous> -> .Call
Execution halted
I experimented around enough to know that it is the colon ':' that is causing the problem, the error is not produced if you use "%A %d" for example.
I searched around and found a number of assertions that single and double quotes are generally equivalent in R, although you can not pair a double quote with a single quote and have it act like two double quotes.
Obviously I have a working code sample that does what I need to do, but I generally use double quotes and am wondering how I can know when I should be using single quotes?