Can't Knit to HTML my R markdown file in R studio - r-markdown

Error message
Here is the error message. The R markdown file can run just fine from top to bottom. But I'm not sure why it says cannot open connection
I tried seeing if there was an error with my directory path but it was fine

Related

Rmarkdown conversion to HTML

I am trying to knit a simple R-markdown document (default document I named "exampled.Rmd"). When I try to use the Knit button it shows the following error message:
Error: object 'y' not found
Execution halted.
It is interesting, because when I run the following from the r-console,
rmarkdown::render('example.Rmd')
it generates the HTML document in the folder.
Does anybody have any idea about what is going on?

I can't knit my rmarkdown files - pandoc error

My university provided laptop was recently replaced and now when I try to knit my Rmd files if get the following error:
pandoc.exe: \\: openBinaryFile: invalid argument (Invalid argument)
Error: pandoc document conversion failed with error 1
Execution halted
These files used to knit perfectly on my old laptop and all of the code blocks within the file still run without errors.
The pandoc_available() function returns TRUE
The answers to similar questions that I have searched suggest it is something to do with the file paths but I am not familiar enough with this to make sense of what I should do. I tried mapping a network drive (Z:) to the folder where the Rmd file is stored and then changing the working directory in RStudio to that drive but it hasn't helped (and now I don't know how to change it back to ~ or what that referred to in the first place)
I have also tried downloading the latest version of Pandoc and a search on Windows Explorer shows that has installed in my user directory but I also have a version in C:\Program Files\RStudio\bin. That has also not helped.
I'm not sure if this is relevant but here is the information on the R version that I am running:
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
Can you tell me what other information is required to diagnose the problem and I will edit to include.
I am sorry this question is so poorly specified and would appreciate any help to improve it.
**** UPDATE ****
I have found that if I
(i) specify that I want a .md file in the YAML header,
(ii) create an .md file by knitting the markdown file,
(iii) copy that .md file manually to the Pandoc directory
(iv) run pandoc.exe -s -o test.knit.md test.html from the MSDOS command prompt within the Pandoc directory,
then I can create the html output file.
However, changing the working directory for RStudio to the Pandoc directory and running
x <- rmarkdown::render("test.Rmd", run_pandoc = FALSE, clean = FALSE)
knit_meta <- attr(x, "knit_meta")
rmarkdown::render( input = 'test.knit.md' , knit_meta = knit_meta )
as per https://stackoverflow.com/questions/38908766/how-to-generate-an-md-file-from-a-rmarkdown-file-containing-an-htmlwidget gives the same error as shown in my original post.
Does this prompt any thoughts that might lead to a solution to my problem?
The university IT people were able to solve my problem by uninstalling R and RStudio from the network drive and installing it on the C: drive and I am now able to knit successfully.

C++ cannot open source file "hboost/predef/os/cygwin.h

I'm working with Houdini HDK (API), when I include
#include<OP/OP_OperatorTable.h> or some other preprocessor i get the error message
the visual studio gives me this error, C++ cannot open source file "hboost/predef/os/cygwin.h
the full error message is: Severity Code Description Project File Line Suppression State
Error (active) E1696 cannot open source file "hboost/predef/os/cygwin.h" NodeCreation C:\Program Files\Side Effects Software\Houdini 17.5.467\toolkit\include\hboost\predef\os.h
After I see this message for the first time I thought I should install Cygwin for windows, and I install the Cygwin but I get the error again
there's no cygwin.h file in this path, visual studio is searching for this file in this path
what's the problem and what should I do?
If you dont have cygwin.h that means you miss something when you install the Houdini API. I try a FULL installation by checking ALL the buttons below:
At the end, you will have this in your installation folder :
I am unable to tell you which one is responsible for installing "cygwin.h" but that should solve your problem.

rmarkdown error: "myfile.tex"' had status 1

I am trying to compile an RMarkdown document from an R script. This is the code I am running:
setwd("C:/Users/me/me_VN02_5676/myfolder")
rmarkdown::render("myrmd.Rmd",
output_file = "mypdf.pdf")
This results in the error:
Error: Failed to compile mypdf.tex.
In addition: Warning message:
running command '"pdflatex" -halt-on-error -interaction=batchmode "mypdf.tex"' had status 1
Does anyone know what is happening?
Additional Notes
The PDF file is created when I use the Knit button in RStudio
This code does produce the .Tex file and when I run that it produces the pdf but render() does not produce the pdf
When I run the .R file via the command line it works! The PDF is created but why doesn't it work in R studio?
It would help to provide a Minimal Working Example so that we can attempt to replicate the problem. However, there may be two potential causes:
File Paths Look Incorrect
In R, they should be specified with a single forward slash: https://stat.ethz.ch/R-manual/R-devel/library/base/html/file.path.html
setwd("C:/Users/me/me_VN02_5676/myfolder")
rmarkdown::render("myrmd.Rmd",
output_file = paste0("mypdf.pdf")
)
PDF Output File May be Open
Another potential cause of this is that the PDF file is open, and therefore pandoc cannot save the output PDF. Try closing the PDF and render the document again.
Link to previous issue in Knitr which relates to this: https://github.com/yihui/knitr/issues/1209

python error can't open pdf in application from python

I am using windows 10 and python 2.7.13 .
My target is to open a pdf in acrobat reader at a specific page number.
I am using the code I received from one of the questions in the forum here.
import subprocess
import os
path_to_pdf = os.path.abspath('C:\test_file.pdf')
# I am testing this on my Windows Install machine
path_to_acrobat = os.path.abspath('C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe')
# this will open your document on page 12
process = subprocess.Popen([path_to_acrobat, '/A', 'page=12', path_to_pdf], shell=False, stdout=subprocess.PIPE)
process.wait()
It opens up the acrobat reader application but the file doesnt open and i get the error :"There was an error opening this document. The filename, directory name, or volume label syntax is incorrect
but when I use these commands in cmd without python I am successfully able to open the pdf without any error. Please help.
Try to open the file with r:
path_to_pdf = os.path.abspath(r'C:\test_file.pdf')
path_to_acrobat = os.path.abspath(r'C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe')
Check this out too, it will show to you an example of an error with the white spaces on the path
Please check the path of your acrobat reader.
In my case:
path_to_acrobat = os.path.abspath('C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\AcroRd32.exe')