title: and output: gives the following error "Error in -title : invalid argument to unary operator"

title: "R9_MTMM"
output: html_document

When I run the code above I get the following error: "Error in -title : invalid argument to unary operator" why would I have it?

I can generate that error if I run the title line individually using CTRL + Enter. The document knits correctly when I click the knit button. From that evidence, it seems this behavior is normal. What are you trying to accomplish by executing the title line?

Actually, I could not understand why would it be used. Following this code I have

knitr::opts_chunk$set(echo = TRUE)
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())

I think I only have to modify the codes above according to my directory. Because when I run the second line that is knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file()) I get the following error: " Error: No root directory found in C:/Users/asus/Desktop/RTEST or its parent directories. Root criterion: contains a file matching "[.]Rproj$" with contents matching "^Version: " in the first line"

I have never used the rprojroot package nor have I set the root.dir of a knitted document. The error you are getting complains that there is not a .Rproj file in the directory path. Have you made a project directory?
More generally, what are you trying to do?

1 Like

I did not create the file in my directory. So without running this code I can read the dataset and I can use the script as it is. This script is used by several people so i think it is only for sharing the result and working on the codes together. As an individual by myself I can run the codes without creating such a file.

If you can successfully run the rest of the code in the document, it is probably OK to comment out the line

knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())

There should be a button labeled Knit just above the code pane in RStudio. What happens if you click that?

This topic was automatically closed 21 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.