'Error in -title : invalid argument to unary operator

I am not sure why I suddenly started getting this error (Error in -title : invalid argument to unary operator) when running my R Markdown file.

My Markdown file looks like this:.

--- 
title: "Bios653 HW1"
author: "Genevieve" 
date: "1/28/2022"
output: html_document
---

My Console looks like this: <\br>

> --- 
+ title: "Bios653 HW1"
**Error in -title : invalid argument to unary operator** 
> author: "Genevieve"  
Error: object 'author' not found  
> date: "1/28/2022"
Error in date:"1/28/2022" : NA/NaN argument 
In addition: Warning message:
NAs introduced by coercion  
> output: html_document  
Error: object 'output' not found
> --- 


Solution 1:[1]

It seems like you are just running this with R, e.g. with source, instead of knitting the document.

Use knitr::knit("FILENAME.Rmd"). If you are using RStudio you can click the knit button

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 alko989