Error in -title : invalid argument to unary operator

Rmarkdown suddenly started giving the following errors when compiling.

> 
> > ---
> + title: "Untitled"
> Error in -title : invalid argument to unary operator
> > author: "ronj2303"
> Error: object 'author' not found
> > date: "6 2 2021"
> Error in date:"6 2 2021" : NA/NaN argument
> In addition: Warning message:
> NAs introduced by coercion 
> > output: html_document
> Error: object 'output' not found
> > ---
> +

This is from compiling the first 6 lines of code that appear when you start a new .rmd document:

---
title: "Untitled"
author: "ronj2303"
date: "6 2 2021"
output: html_document
---

Weirdly, knitting works flawlessly. I have tried rebooting Rstudio, updating the markdown package, to no avail; the default .rmd template is riddled with these errors (and my markdown scripts as well).

I'm quite new to markdown and R in general.
I am posting here because google searches did not yield any solution regarding these errors.

Thanks in advance!

Weirdly, knitting works flawlessly. I have tried rebooting Rstudio, updating the markdown package, to no avail; the default .rmd template is riddled with these errors (and my markdown scripts as well).

I'm quite new to markdown and R in general.
I am posting here because google searches did not yield any solution regarding these errors.

Thanks in advance!

So you means this works when you are trying to knit the document (using the Knit button in RStudio IDE I presume?)

When exactly does the issue you described happens ?

It seems you sent tha YAML header to console.

You may read the basics if not already

Yeah that was indeed a rookie mistake. I was trying to run the whole code through the console. Sorry about that, thanks for the link!

1 Like

No worries!

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

Will do, good to know. Cheers!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.