R Markdown - First Attempt - Strange Error Message - r

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<

Related

R markdown - Not knitting despite the notebook running without Error

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.

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?

R Notebook - code chunk gets separated in preview

I am using R notebook to preview the file. Even though all the code is in one chunk, a line gets separated into two. Would you please tell me how I can resolve this?
As you can see all the code is in one chunk.
However, when I run this chunk, it gets separated into two.
I am not sure if it matters but here is the code I am running.
library(MASS)
par(mfrow=c(3,1))
hist(galaxies, breaks=500)
hist(galaxies, breaks=100)
hist(galaxies, breaks=50)
Also here are the versions of R and RStudio. I an new to R so I am not sure what is causing this. If you need any other information, please let me know. Thanks
R version 3.3.2 (2016-10-31)
Rstudio version 1.0.136

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!

R Studio Convert .RMD to pdf

all
Ufff... I believe I did my hw to research this and still don't have an answer so asking all:
I have R-Studio, valid RMD file, when I tried to I don't get new .pdf file, I have viewer which is still html.
No problem to create HTML, it works fine, but I need pdf.
tried to use render ("file.RMD", "file.PDF") to find that I don't have render, tried install pandoc, got an error < package ‘pandoc’ is not available (for R version 3.1.2)>
so what is the simple way to get that pdf, why my doesn't work as desinged? what I'm missing I put that info into header too...
output: pdf_document
Im totaly lost, appreciate help.
render("Proj1.RMD", "Proj1.pdf")
Best
Mario

Resources