.rda object not recognized in R vignette - r

I am creating an R package, and have a graph.rda file inside my data folder.
In RStudio in the .rmd vignette file, I read the data in:
data(graph)
head(graph)
but when I "Knit HTML" the .rmd vignette file, I get an error on these above two lines saying:
"Error in head(sbTree): object 'sbTree' not found Calls:
<Anonymous> ... withCallingHandlers -> withVisible ->
eval -> eval -> head Execution halted"
I have tried researching for solutions and tried some of the suggestions (like adding library(knitr)), but to no avail.
Any advice is greatly appreciated!

Related

How do I compile a pdf report with this error?

I am trying to compile a pdf report of my R code. I imported the dataset using the menu options but am now having trouble compiling it because R cannot find the .csv files I used. I have triple checked and the working directory is correct.
I get this error:
Error in eval(expr, envir, enclos) : object 'filename' not found
Calls: <Anonymous>...withVisible...-> eval with Userhandlers -> eval -> eval
Execution Halted
Would appreciate any help. Thanks!
Tried getwd() and setwd() but that doesn't seem to be the issue. Double checked file names and location.
Are you trying to compile an RMarkdown file to pdf? If so, you can specify the working directory in the beginning like this:
knitr::opts_knit$set(root.dir = '/tmp')
At any rate, it should also work if you use the full path name as filename.

Can't knit RMarkdown?

When I'm knitting my r markdown document it all runs smoothly until 1 chunk near the end where I get the error in the render tab (near where the console is):
error pic
I'll write down what the code says just in case the image doesn't load:
Quitting from lines 1321-1372 (narrative_analysis2.Rmd)
Error in app$vspace(new_style$`margin-top` %||% 0) :
attempt to apply non-function
Calls: <Anonymous> ... <Anonymous> -> .transformer -> clii__container_start
Execution halted
Lines 1321 - 1372 are in a specific chunk where no errors come up when I run that specific chunk. I uploaded my excel data through readxl package. The chunk before and the chunk after all run smoothly. I don't know what is the issue. narrative_analysis2 is the name I saved the markdown as.
I have reinstalled knitr, readr, readxl, cli and restarted the session and nothing has worked. I don't understand why it won't knit.
Does anyone have any advice?

How do I fix this error code in R Markdown?

I am trying to use R Markdown for the first time and I keep getting an error code that says is occurring in the line with "library(knit)".
```{r setup}
library(knitr)
source("analysis.R")
```
The error code I keep getting is:
Error in contrib.url(repos, "source"): trying to use CRAN without setting a mirror
Calls: <Anonymous> ... withVisible -> eval -> eval -> install.packages -> contrib.url Exacution halted
Anybody know where I should go from here?
I think it gives you the line where the block starts not the line with the error.
Without much more to go on, I'd be suspecting the source. What happens when you run that block?
What happens if you open R from the command line and source it ?
It appears something is trying to install something...
I figured it out! I had an "install.package" line in my R.analysis that was preventing me from knitting. 

Need to have the source created with Rmarkdown otherwise error message

Hello StackOverflow community,
I have been trying over the last few weeks using R Markdown to Knit HTML file.
While it use to run smoothly the previous time, over the last week I keep on getting the following error
Quitting from lines 43-92 (Vizualisation.Rmd)
Error in eval(lhs, parent, parent) :
object 'processed.feedback' not found
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> %>% -> eval -> eval
Execution halted
The thing is that my source 'processed.feedback' is loaded within my Global environment. But is not created with the .rmd but before in a script file.
If I do the wrangling as well in the same Rmarkdown the it works fine (no error). But I would love to keep the wrangling part in a separate file.
Any suggestion.
Thanks in advance for your feedback and help!
If you are at the Rstudio conference - enjoy!
The usual model is that R Markdown files do not see objects that are in your workspace: they start with a blank workspace, so that anyone can reproduce the computation. (There are ways to work in an existing workspace, but you shouldn't use them.)
If it takes too long to create an object in the Rmd code, then there are at least two options: turn on caching (so it only happens when necessary), or save the object in a separate file using save() and load it in your document using load(). Remember to distribute the save file along with the .Rmd file if you want to give this document to someone else.

xlsx package and Rmarkdown

I'm using xlsx to read from my Excel files (actually OpenOffice, saved as .xls) with the read.xlsx function.
It's working perfectly fine in .R scripts, and it runs perfectly fine in .Rmd code chunks. But then when I try to make a pdf/html/whatever using knitr, I get:
Error in eval(expr, envir, enclos) : could not find function "read.xlsx"
Calls: ... handle -> withCallingHandlers -> withVisible -> eval -> eval
Help? How can it not find a function it has already used in the same .Rmd file?

Resources