Error R Markdown/Compiling Report


I am quite new to this, so please bear with me :slight_smile:

I am trying to compile a report or a Markdown Script (Tried both -> the same error with both). This worked fine for one of my scripts, with the other one I am struggling. R can't find the File. The path is absolutely right, I tried it with different options (copied from Mac Finder Informations directly, copied from R "import file", etc. With the first Markdown script adding "~/" helped, it did not with this one.)
The code is below, it runs fine in R, the file is found etc.

data <- read_excel("~/Desktop/Promotion/Histologie/AuswertungHistoKomplett.xlsx")

This is the error that comes up when I try compiling a report/Knit a Markdown document:

processing file: AuswertungHisto_Lilith.spin.Rmd
|................................... | 67% [unnamed-chunk-1]
Quitting from lines 3-130 [unnamed-chunk-1] (AuswertungHisto_Lilith.spin.Rmd)

! object 'AuswertungHistoKomplett' not found

  1. utils::View(AuswertungHistoKomplett)
    Execution halted

I already spent a lot of time on google to find a solution for this but nothing worked yet.

Thanks a lot in advance

Is this done from within your Rmd file ? If not,it means the data won't be loaded and available when you are rendering.

in R Markdown it would need the ```{r}, right? I tried that and had exactly the same error. Or what do you mean exactly?

I mean that AuswertungHistoKomplett needs to exist as an object in your environment. Currently you load the xlsx file in data object - not the same name as you file

You cannot use view in a .rmd or .qmd document.

1 Like

:laughing: I missed that ! This is indeed additional problem, in addition of the name !

Thanks - @Lily1 I believe you can solve your issue now.

Well, I missed the name! :confused:

Thank you both! Excluding "View" solved it! Even ChatGPT missed that, so don't worry!

1 Like

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.