R markdown - Not knitting despite the notebook running without Error - r

So I am trying to make a R markdown using a package loaded from source.
install.packages('/Users/~/Desktop/BPA/rBSEM_0.2.1.tar.gz', repos = NULL, type = 'source')
With a clear environment, the code runs successfully. However, when I try to knit the document, I run into several errors.
The first is that "object 'sample_SEM' not found". This stems from this line of code:
data(sample_SEM)
Where sample_SEM is data encoded into the rBSEM package.
The next problem is that it cannot find the function 'getInputGraph' - which is in the package.
inputAdj <- getInputGraph(blockList = blockL,blockGraph = G,varNames=names(sample_SEM))
Does anyone have any suggestions? Sorry I couldn't be more specific but I'm not quite sure what is happening here.
Thanks!

have you ran library(rBSEM) at the top of your first R chunk? You may have ran library(rBSEM) at the console, but if it's not in the first R chunk, it's not being loaded when knitting the document.

Related

Knit to flexdashboard issue

I am trying to "knit to flex_dashboard" the following code in RStudio. I am giving a link because pasting it directly here is causing formatting problems.
https://github.com/futdevseige/R-code/blob/main/Code.rmd
Now, when I try to use the "knit to flex_dashboard" function in RStudio, it is giving me the following error:
I updated r version using the console, but that didn't fix it. RStudio is also up to date.

R Markdown - First Attempt - Strange Error Message

I'm trying to create an R Markdown script for the first time today in RStudio. I have an existing R script which produces lots of graphs, and I'm hoping to use Markdown to produce .pdf files containing these graphs.
I started very simple:
```{r}
10 * 10
```
When I clicked on the "knit" button I saw an error message:
I ran getOption("repos") at the console and I saw:
"https://mran.microsoft.com/snapshot/2019-02-01"
I don't know if it's relevant (I suspect it is): I'm not using standard R, I'm using Microsoft R Client 3.5.2 because I need access to the revoScaleR package.
I don't really understand what's going on here but it looks as if I'm using out of date stuff...can anyone help fix this please?
Thank you.
Ahhhh...I think I've fixed it:
options(repos = c(CRAN = "https://cran.rstudio.com"))
Hoping this doesn't have any unintended consequences! >crosses fingers<

My code will run as a chunk but gives me an error when I try to knit

Hi I'm new to R and I'm using RStudio Cloud for a university stats course.
The code I'm having trouble with will run as a chunk but when I try to knit the project it comes up with an error saying that the object 'filename' not found.
The 'filename' is listed in the global environment but it is a tbl_df, which I'm thinking is not the right kind of object for knitting.
It is difficult to answer without having all the code. And code is almost always better than a screenshot.
My guess is that you loaded the dataset X2019THBrier manually in RStudio. Thus you can access it in chunks, in the current R session, but not in the knitted R session.
You need to write commands to load the data. As you are loading an XLSX file, you might want to install the openxlsx package, and use the openxlsx::read.xlsx() command.

R building a package gives different output for vignette

I am building my first R package and I am facing some problems.
When I run knitr from the Rstudio I get the html vignette as I want it.
However when I run R CMD Build I realize that I have 2 vignettes.
One found in vignettes/vignette.html and the other in inst/doc/vignette.html
Each one of these gives a different result for the vignette, I tried to check the .Rmd for each and changed them to be the same but I still get different results.
The .Rmd file does not reflect the html file being produced for both vignettes?
Any ideas?

Converting Knitr to PDF

I am trying to convert my knitr to a PDF.
Currently I have been trying the drop down menu in RStudio and selected Knit to PDF.
Error: pandoc version 1.12.3 or higher is required and was not found.
I have downloaded Pandoc here (pandoc-1.15.0.6-windows.msi):
https://github.com/jgm/pandoc/releases
I tried re-running it and the same problem keeps occurring. I am not sure if it is a directory issue or if I am just typing something wrong in but I am having major trouble with this.
Would someone be able to produce a reproducible example in how to type this into R.
Any help would be greatly appreciated and would save me big time. (By the way, I have no trouble with HTML, just PDF)
Thanks!

Resources