Debugging problem when knitting from r markdown to pdf - r

I've downloaded miktex, tinytex and ghostscript and tried changing the path since the problem seems to be in the path. So far nothing has helped me and I would appreciate some help:
This is my error message:
Error: LaTeX failed to compile Uebungsblatt1_MAT183.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Uebungsblatt1_MAT183.log for more info.
In addition: Warning message:
In has_crop_tools() :
Tool(s) not installed or not in PATH: ghostcript
-> As a result, figure cropping will be disabled.
Execution halted
Any help or try to troubleshoot would be appreciated. Thank you

I have figured this out for myself by now: what I did was that I first uninstalled MikTex and tinytex because they apparently were clashing somehow. Then I reinstalled tinytex - this time typing it directly into the console instead of using the installing tool from R - so I typed everything at a time and executed it. It had me restart R and updated some files then too. Since then it has worked flawlessly. Also, I did the same on my other computer (MacBook) where it didn't work so chances are pretty good that that might solve that same problem for someone else out there. Thanks to everybody who tried helping and improved the question or sent responses.

Which code you tried to compile?
Sometimes this error rise when a letter is missed in the \begin function. If you tried to compile an array, do not forget to use the same letters as rows you need.
Example:
$$|x|=\left\{\begin{array}{ll} -x & \text{si }x\le 0\\ x & \text{si }x\ge 0 \end{array}\right.$$

Related

R MarkDown Error: pandoc version 1.12.3 or higher is required and was not found

I'm using R Studios Cloud but I am suddenly experiencing difficulty knitting my markdown in any format (html, pdf & word).
This is the error I'm thrown when I press the knit button:
pandoc version 1.12.3 or higher is required and was not found (see the help page ?
rmarkdown::pandoc_available).
Execution halted
I then check if pandoc is installed via pandoc_available():
> pandoc_available()
[1] FALSE
False, so I try to install pandoc again? (I do not recall uninstalling it)
> installr::install.pandoc()
sh: 1: ifconfig: not found
Error in system("ifconfig", intern = TRUE) : error in running command
However, again I get another error for ifconfig: not found.
I am new to learning R and programming as a whole. I'm quite stumped. I have checked recent threads including popular solutions (linked below) to no avail.
I have also tried opening a new markdown file but still could not get knit to work.
I'd appreciate any help on this one.
popular solution to resolve pandoc version 1.12.3 error
Found the solution.
Relaunch your project by clicking on the 3 dots in the upper right corner.
See thread here.
Seems to be a common error happening to a lot of r studio cloud users in the past 24 hours.

Shinyloadtest: Error: Please upgrade your pandoc version to be at least v2.2

I am trying to run results from recording.log, as instructed from https://rstudio.github.io/shinyloadtest/ I am running below command to see in browser view:
shinyloadtest::shinyloadtest_report(df, "run1.html")
but throwing an error :
to resolve this, when I am trying install pandoc, throwing below error
what I am doing wrong in this?
can any one please help me on this!
My Issue was resolved, I have used one command in R Studio that can overpass pandoc issue:
shinyloadtest_report(df,"run1.html",self_contained=F)

R installed.packages() randomly stopped working on windows 7

installed.packages() command in R lists your installed packages. Mine was working for almost a year and then this command randomly started throwing an error. As this is a built-in command, I am not even sure how to "reinstall" it or address this. Any ideas how to fix the error and get the command working again?
> installed.packages()
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning message:
In gzfile(file, mode) :
cannot open compressed file `'C:\Users\Mitch\AppData\Local\Temp\Rtmp6Dawpa/libloc_190_4464fd2b.rds', probable reason 'No such file or directory'`
One suggestion on here involved this in combination:
.libPaths()
installed.packages(lib.loc = 'my path')
The results of this produced yet another error as shown here. Looks like an issue with the installed file still but how to address is the question:
> installed.packages(lib.loc = 'C:/ProgramFilesCoders/R/R-3.3.2/library')
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning message:
In gzfile(file, mode) :
cannot open compressed file 'C:\Users\Mitch\AppData\Local\Temp\Rtmp6Dawpa/libloc_190_4464fd2b.rds', probable reason 'No such file or directory'
>
That is odd.
What version of R are you running, standard R or Microsoft R? And did you recently update?
If you did recently update, perhaps your packages did not get copied over, hence the 'No such file or directory' statement.
If you haven't updated, I would install a newer version and see if it fixes the issue.
If your uncertain, you can always use the updateR function to check if you have the latest version and choose to install it or not.
library(installr)
updateR()
Good luck,
I think the issue lies in terms of the where the function is looking for the package information. installed.packages() needs an argument lib.loc.
From official documentation
lib.loc character vector describing the location of R library trees to search through
Looks like the function for some reason is looking in AppData\Local\Temp which is the download location and not the installed location.
Without looking at your R_Home and .libPaths() is difficult to nail down where the problem is, however running .libPaths() should give you one or more paths as shown in the below example. None of these should be temp locations.
>.libPaths()
[1] "C:/Users/UserName/Documents/R/win-library/3.4"
[2] "C:/Program Files/R/R-3.4.0/library"
If not, you can set the path within the .libPaths("your path") or pass the path of the library as part of installed.packages(lib.loc = 'your path') and try again.
Sometimes the most simple obvious solution is what works:
I closed my RStudio environment saving it to .RData
I re-opened RStudio and tried the command again
it worked
For the future, some good ideas got posted on here before I thought to try the above. Here are the suggestions that others included in case the above does not work if this problem is encountered by anyone in the future:
Use .libPaths() to find out proper path where this is installed, and then re-run the command with the path included in it like so: installed.packages(lib.loc = 'your path')
Try debugging it with: debug(installed.packages); Expectation is that we will likely find something wrong with .readPkgDesc(lib, fields) while stepping through debug. This was not tried yet so you may encounter things not written up here when you do try it.
Try Updating R in case it is out of date with these commands: library(installr) and updateR().

RStudio Required Package Versions Could Not Be Found

I updated my Mac to OS10 and attempting to run RStudio Knit, and get the error:
"evaluate 0.7.2 is required but 0.7 is available".
I tried this and did not fixed the issue:
remove.packages("evaluate")
install.packages("evaluate")
Any help would be appreciated.
Try setting up the below option and by rerunning the code.
getOption("repos")
options(repos = c(CRAN = "https://cran.rstudio.org"))
It also happened to me. I downloaded evaluate zip file from here https://cran.rstudio.com/web/packages/evaluate/index.html
and then manually installed it in R Studio (Tools-InstallPackages-zip file).
Good luck !
install.packages('evaluate')
Warning in install.packages :
unable to access index for repository HTTP://cran.rstudio.com/bin/windows/contrib/3.4:
cannot open URL 'HTTP://cran.rstudio.com/bin/windows/contrib/3.4/PACKAGES'
When you compile the update or remove sentences, if the output like this, you could make some settings, since maybe the problem is your internet. Follow the steps:
Open Rstudio.
Click tools.
Choose global options->packages.
Modify CRAN to the country you living. like, China or Japan. Cause your browser maybe work only you do this.

R EnvironmentError: Could not find Ghostscript on path. RWebLogo

I ran into an odd issue that I cannot fix in any way and I was hoping someone here may have a better understanding of whats wrong;
I am unable to use RWebLogo package - even run the simplest examples due to the same missing Ghostscript error.
e.g. running:
library(RWebLogo)
aln <- c('CCAACCCAA', 'CCAACCCTA', 'AAAGCCTGA', 'TGAACCGGA')
weblogo(seqs=aln, file.out='mylogo.pdf')
Throws this error:
Traceback (most recent call last):
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogo", line 71, in <module>
weblogolib._cli.main()
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogolib/_cli.py", line 82, in main
formatter(data, format, opts.fout)
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogolib/__init__.py", line 757, in pdf_formatter
gs = GhostscriptAPI()
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogolib/__init__.py", line 196, in __init__
raise EnvironmentError("Could not find Ghostscript on path."
EnvironmentError: Could not find Ghostscript on path. There should be either a gs executable or a gswin32c.exe on your system's path
I have installed ghostscript ver 9.15 with configure/make/install in the terminal and then added the PATH to bash profile and executed it. When I run gs in the terminal it works, confirming it is set to the system path, yet the same error still occurs. Even after rebooting.
I tried adding the gs to the environment in R directly:
Sys.setenv(R_GSCMD = "/Applications/ghostscript-9.15/bin/gs")
which also hasn't helped... Gives exactly the same error. When I search the R environment it shows that gs is there.
Important version information:
MAC: OS Yosemite 10.10.1;
R version 3.1.1 (2014-07-10);
Platform: x86_64-apple-darwin10.8.0 (64-bit);
RWebLogo_1.0.3
Do you know of any issue that may have cause this problem? I'm new to programming, so I am worried I may be missing something basic. I would be grateful for any advice. Thank you!
I have gotten in touch with Omar, the author of RWebLogo, and he has been really helpful in pinpointing my problems and resolving the issue.
First, he advised to run the RWebLogo on a test sequence on the terminal:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogo -f test_seqs.txt -o ~/Desktop/out.pdf -F pdf
Change the base directory (everything before extdata/weblogo …) of the script above to be whatever the command below gives you in R:
system.file(package = 'RWebLogo')
I ran it and got a new error: the lack of numpy. I actually had the numpy installed but without full user privileges. After reinstalling numpy, the RWebLogo was successfully running from the terminal.
Still, the RStudio was throwing a GhostScript error. Omar suggested that there is a problem with an older version of RStudio running on Yosemite (I currently have 10.10.1), and sent me a link to an updated RStudio version where the problem was fixed.
http://www.r-bloggers.com/r-and-rstudio-incompatibility-with-yosemite-mac-os-x-10-10/
I got the updated RStudio and everything works great there right now. Hope this helps someone with a similar issue!

Resources