0

I am using R Markdown render to automate sales reporting and I am hit with the following error message:

Error: Invalid YAML front matter (ends with ':').

R Studio, function worked previously. I have tried most quick fixes I've seen online but nothing has worked.

Additionally, if you have any advice for importing company logos, I would love to hear it. When knitted locally, it appears, but once it is sent out, it disappears. I'm sure this is due to the local file path, so any advice for calling it in a non-local manner?

---
output: html_document
params:
---

![](/Users/bingbong284/Desktop/markdown/CopyOf Header.jpg)

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, comment = NA)
library(dplyr)
library(tidyverse)
library(knitr)
library(kableExtra)
library(yaml)
library(rmarkdown)
``` 

```{r echo=FALSE, message=FALSE, warning=FALSE, paged.print=FALSE, comment = NA}
today <- Sys.Date()
```

`r format(today, format="%B %d, %Y")`


To Whom It May Concern,

Below is your sales report for fictitious name.

```{r include=FALSE}
aug_rent <- read_csv("Aug R Rent.csv")
colnames(aug_rent)[colnames(aug_rent)=="Vendor ID"] <- "Landlord"
organ_aug <- arrange(aug_rent, aug_rent$'Landlord')
vendors <- unique(organ_aug$`Landlord`)
```



```{r echo=FALSE}
render_my_report <- function(vendor) {
  rmarkdown::render("Remote.Rmd",
                    output_format = "html_document",
                    output_file = paste0(vendor, "_sales_report_", Sys.Date(), ".html"),
                    params = list(Landlord = vendor),
                    output_options = list(self_contained = FALSE, lib_dir = "libs"))
}

purrr::walk(vendors, render_my_report)
```

```{r echo=FALSE, message=FALSE, warning=FALSE, comment=NA}
test_data <- filter(organ_aug, organ_aug$'Landlord' == params)
last_table <- knitr::kable(test_data, captio = "August 2019 Sales Report")
kable_styling(last_table, font_size = 14)
```


If you have any questions regarding this report, please email BingBong284@ficticiousname.com or reach out to BingBong284, BingBong284@ficticiousname.com.

Thank you,

BingBong284, Finance 

Function previously generated 66 unique sales reports for 66 vendor ID's, but it is now hitting me with the error listed above.

Jim G.
  • 15,141
  • 22
  • 103
  • 166
  • For *"send it out ... missing"*, see https://stackoverflow.com/q/49316205/3358272 ... but since you explicitly state `self_contained=FALSE`, I suspect you are doing it to yourself. If you inspect the resulting HTML document that contains the image, if it's an `img` tag, is the `href=` a relative or absolute path? It might be better for you to make it self-contained. – r2evans Sep 04 '19 at 04:35
  • 5
    As to your first issue/question: The `Error: Invalid YAML front matter` derives from the empty `params:` line in your YAML header. Either remove it, or include a/any parameter(s). – Maurits Evers Sep 04 '19 at 05:34

0 Answers0