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
My program runs exactly how I want it to run. All I need to do now is knit the program. How do I save my data that I have imported through R studio so that I can call it in my program and knit?
I have tried save(), save.image(), knitting directly using code that supposedly should have knitted using what was in the environment, and importing data directly using code(this left me with even more problems so I gave up).
This is my latest effort:
dir()
[1] "airline.Rdata" "airline.Rds" "cheesedata.Rdata"
[4] "cheesedata.Rds" "desktop.ini" "myEnvironment.RData"
load('cheesedata.Rds')
load('airline.Rds')
The rest of the code should be fine
Quitting from lines 3-47 (HW3.spin.Rmd)
Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
Calls: ... withCallingHandlers -> withVisible -> eval -> eval -> load -> readChar
Execution halted
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.
I ran shiny app in linux.
I open the browser in the url: http://192.241.147.231:4949/sample-apps/MonitorUI/
The page is open but after a second disconnected.
I check the log file and it write to me this massage:
Error in eval(expr, envir, enclos) :
You are attempting to load an rmarkdown file, but the
rmarkdown package was not found in the library. Ensure that
rmarkdown is installed and is available in the Library of the
user you're running this application as.
Calls: local -> eval.parent -> eval -> eval -> eval -> eval
Execution halted
I already downloaded the "rmarkdown" package. and it updated.
What is the problem? i don't find anything for this problem in the web.
the sample app that given by shiny-server package:http://192.241.147.231:4949/sample-apps/hello/ is working so what is the problem?
Thanks.
I am trying to set up a task that runs a batch-file, that runs a .rmd file which should knitr me a lovely .html file each day.
Everything works fine, if I run the batch-file manually. However, when I run it through the task scheduler, I get the following error from the command prompt:
Error in file(con, "w") : cannot open the connection
Calls: <Anonymous> -> knit -> writeLines -> file
In addition: Warning message:
In file<con, "w") : cannot open file 'residual_v1.md" : Permission denied
Execution halted
The same user is listed as the "author" in the task-scheduler, as the user when you open the start menu.
Batch-file code:
"C:\R\R-3.0.3\bin\x64\Rscript.exe" -e "library(knitr,dplyr); knitr::knit2html('C:/R/Rapporter/residual_model/Residual_v1.Rmd')"
Im am at a loss of what to do.
It looks you do not have write permission in the working directory of R. I'd recommend you to set the working directory before you run knit2html(), e.g.
setwd('C:/R/Rapporter/residual_model/')
knitr::knit2html('Residual_v1.Rmd')
i.e.
"C:\R\R-3.0.3\bin\x64\Rscript.exe" -e "setwd('C:/R/Rapporter/residual_model/'); knitr::knit2html('Residual_v1.Rmd')"
Or any other output directory in which you have write permission:
setwd('any/output/directory/you/want')
knitr::knit2html('C:/R/Rapporter/residual_model/Residual_v1.Rmd')