I am trying to create a PDF export of some of my R outputs (tables and graphs). I created a .Rmd document and I have tried to run the simplest of code setting up the document, but I immediately get an error. The same error pops up when I click the "Knit" button at the top of the R studio window.
The code:
---
title: "Example"
author: "Me"
output: pdf_document
---
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
The error:
Error in namespaceExport(ns, exports) :
undefined exports: Sweave2knitr, all_labels, all_patterns, all_rcpp_labels, asis_output, cache_engines, clean_cache, combine_words, current_input, dep_auto, dep_prev, engine_output, extract_raw_output, fig_chunk, fig_path, hook_ffmpeg_html, hook_gifski, hook_mogrify, hook_movecode, hook_optipng, hook_pdfcrop, hook_plot_asciidoc, hook_plot_custom, hook_plot_html, hook_plot_md, hook_plot_rst, hook_plot_tex, hook_plot_textile, hook_pngquant, hook_purl, hook_r2swf, hook_scianimator, hooks_asciidoc, hooks_html, hooks_jekyll, hooks_latex, hooks_listings, hooks_markdown, hooks_rst, hooks_sweave, hooks_textile, image_uri, imgur_upload, include_app, include_graphics, include_url, inline_expr, is_html_output, is_latex_output, is_low_change, kable, kables, knit, knit2html, knit2pandoc, knit2pdf, knit2wp, knit_child, knit_code, knit_engines, knit_exit, knit_expand, knit_filter, knit_global, knit_hooks, knit_meta, knit_meta_add, knit_params, knit_params_yaml, knit_patterns, knit_print, kni
Calls: loadNamespace ... namespaceImportFrom -> asNamespace -> loadNamespace -> namespaceExport
In addition: Warning message:
S3 methods '$.knitr_strict_list', 'is_low_change.default', 'knit_print.default', 'knit_print.knit_asis', 'knit_print.knit_asis_url', 'knit_print.knitr_kable', 'print.knitr_kable', 'process_group.block', 'process_group.inline', 'process_tangle.block', 'process_tangle.inline', 'sew.character', 'sew.default', 'sew.error', 'sew.html_screenshot', 'sew.knit_asis', 'sew.knit_embed_url', 'sew.knit_image_paths', 'sew.list', 'sew.message', 'sew.recordedplot', 'sew.source', 'sew.warning' were declared in NAMESPACE but not found
Execution halted
I've tried updating all of my packages and restarting R. I've also tried changing the working directory.
It also seems like Knitr package isn't loading (it's not checked in the packages tab). I just tried checking the box and I received a "fatal error" message and R needed to restart. Once it restarted, I was able to check the box without a "fatal error" but the original error still appears in the console.
To solve this issue, I tried uninstalling the Knitr package but received an error:
cannot delete reparse point 'C:\Users\R\win-library\4.1/knitr/R', reason 'There is a mismatch between the tag specified in the request and the tag present in the reparse point'
Warning in install.packages :
cannot remove prior installation of package ‘knitr’
Warning in install.packages :
cannot delete reparse point 'C:\Users\R\win-library\4.1/knitr/R', reason 'There is a mismatch between the tag specified in the request and the tag present in the reparse point'
Warning in install.packages :
restored ‘knitr’
To resolve this, I changed the name of the folder for the package to xxx and then installed the package again without any issues.
Once I had reinstalled, a new error appeared prompting me to install latexpdf.
I tried to Knit the document again and a new error appeared which lead me to this post: Failed to compile test.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See test.log for more info. Execution halted
As stated in that StackOverflow answer, I ran tinytex::install_tinytex()
After doing this I was able to knit a PDF
I'm new with R and I'm trying to make a pdf file out of a RnW file. I installed MaxTex, restarted my RStudio and tried to compile my Rnw file. For some reason it says 'execution halted' (after R loaded the librabries).
2 : echo keep.source term verbatim (label = setup, 25.3.Rnw:30)
Error in match.arg(options$results, c("verbatim", "tex", "hide")) :
'arg' should be one of “verbatim”, “tex”, “hide”
Calls: -> SweaveParseOptions -> check -> match.arg
Execution halted
What should I do?
I have an Rmarkdown file which currently does not need to source() to other scripting files. There are currently two parameters in the YAML: a numeric input and a file upload for .CSVs
When I "knit with parameters" locally the file runs fine, I've even moved it out of my existing RProj to various other locations on my computer to make sure the working director doesn't matter and the place I'm grabbing .csv files from doesn't impact the knitting process.
When I attempt to publish to my RStudio Connect account I get the following two errors:
Error in file(file, "rt") : cannot open the connection
Calls: local ... withVisible -> eval -> eval -> read.csv -> read.table -> file
This is my current YAML for reference:
---
title: "CPR Report Card"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
prettydoc::html_pretty:
theme: cayman
params:
data:
label: "Input Zoll Dataset:"
value: ".csv"
input: file
age:
label: "Age of Patient"
value: 0
input: numeric
min: 0
max: 17.75
step: .25
---
So, locally and across computers the file works fine. Seems like it should publish ok to RStudio Connect but currently isn't. This is my first foray into Connect, any help is greatly appreciated!
After communicating with the RStudio Connect support service, using read.csv() from an Rmarkdown file causes issues since the markdown does not have a reactive component to interact with the user's file system. If you wish to have this functionality it's best to look into developing a Shiny application.
I try to save a variable to a relative path. The R code runs without a problem in RStudio, but as soon as I compile the RMarkdown file i get a reproducible error (only if the destination path is relative).
This is my RMarkdown file:
---
title: "Untitled"
output: html_document
---
```{r test}
x<-"test"
save(x,file="./raw_data/test.r")
```
This is the resulting error:
processing file: Untitled.Rmd
Quitting from lines 7-9 (Untitled.Rmd)
Error in gzfile(file, "wb") : cannot open the connection
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> save -> gzfile
Execution halted
Is this a bug / does knitr not support relative directory paths?
Thanks
I am trying to knit a document but I am getting an error on the read.csv function which works fine if I run it from the RMarkdown or from the console.
I have searched but could only find solutions related to reading a csv from a URL.
R read.csv from URL error in knitr
```{r}
# This analysis uses the National Names dataset
national_names_raw <- read.csv("NationalNames.csv")
```
This is the error I get...
Quitting from lines 33-35 (Popularity_of_Kier.Rmd)
Error in file(file, "rt") : cannot open the connection
Calls: <Anonymous> ... withVisible -> eval -> eval -> read.csv -> read.table -> file
Execution halted
Any help is appreciated.