Pandoc not recognized as R library - r

I installed Pandoc manually through this installation - link.
After restarting the system, I was able to locate the installation folder at C:/Users/YourUserName/AppData/Local/Pandoc
But when I'm trying to call the library:
library("pandoc", lib.loc = "C:/Users/YourUserName/AppData/Local/Pandoc")
I'm getting the following error:
Error in library("pandoc", lib.loc = "C:/Users/YourUserName/AppData/Local/Pandoc") :
no library trees found in 'lib.loc'
As i'm behind a firewall, I cannot install pandoc through github. So the install.pandoc() function is out.
Any ideas where I'm getting the installation process wrong?
Edit:
I've changed .LibPath to point to Pandoc's installation folder:
.libPaths('C:/Users/stefanj/AppData/Local/Pandoc')
And if I check, it seems to be ok:
> grep("pandoc", list.files(.libPaths()))
[1] 22 24
library(pandoc)
Error in library(pandoc) : there is no package called ‘pandoc’
Execution halted

I agree to #Dason's point that library in path : "C:/Users/YourUserName/AppData/Local/Pandoc" is not any library/package connected with R. It's just pandoc installed.
Other way to install pandoc would be using installr :
installr::install.pandoc()
Now, for performing for converting from one markup format to another, use the following package :
rmarkdown
The rmarkdown package includes high level functions for converting to a variety of formats. For
example:
render("input.Rmd", html_document())
render("input.Rmd", pdf_document())
Hope this helps.

Related

Errors downloading R package for "Efficient R Programming" by Gillespie and Lovelace

the above-referenced book has an associated R package hosted on github containing datasets and functions used in the book.
The book states this code is used to install the package:
devtools::install_github("csgillespie/efficient", build_vignettes = TRUE, dependencies = TRUE)
I receive the following message and errors when running the code:
SUMMARY: processing the following file failed:
'solutions07.Rmd'
Error: Vignette re-building failed.
Execution halted Error: Failed to install 'efficient' from GitHub:
System command 'Rcmd.exe' failed, exit status: 1, stdout & stderr were printed
Do you have any insight into whether the package itself is causing the error versus a local issue on my end? Or how I might figure out the cause and fix for this issue? I appreciate any help you can provide.
This URL provides the section in the online book I am referring to.
https://csgillespie.github.io/efficientR/introduction.html#book-resources
If I run the following code it works:
devtools::install_github("csgillespie/efficient", build_vignettes = TRUE, dependencies = TRUE)
devtools::install_github("csgillespie/efficientR")
I would suggest to reinstall the devtools package using the following code:
remove.packages("devtools")
install.packages("devtools", dependencies = TRUE)
library(devtools)
Was having the same problem. But after installing Rtools for windows: https://cran.rstudio.com/bin/windows/Rtools/rtools42/rtools.html
And installing from source packages that were recommended to update:
recommended packages
Was able to succefully use efficient, and access its vignettes.
Using version R-4.2.1
devtools version 2.4.5

syntax error near unexpected token - R package Install

I am trying to install an R package along with its dependencies. But it is throwing error.
$ install.packages(rvest_0.3.5.tar.gz, dependencies=True)
-bash: syntax error near unexpected token `rvest_0.3.5.tar.gz,'
I am new to R please help me how can I download this along with it dependencies.
Before this, I tried following
$ R CMD INSTALL rvest_0.3.5.tar.gz
* installing to library ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library’
ERROR: dependencies ‘httr’, ‘magrittr’, ‘selectr’ are not available for package ‘rvest’
But it failed with dependent packages are missing error. And obviously it is cumbersome to install the dependent packages manually. Hence I tried package.install
You need to run it with quotes and capital TRUE:
install.packages("rvest_0.3.5.tar.gz", dependencies = TRUE)
Note this will only work if you have unix-like system and the file is located in your current working directory (check with running getwd() from your R session). Otherwise you need to provide full path to the file (like "~/somefolder/mydata/rvest_0.3.5.tar.gz").
If you run Windows, then you need .zip file instead of .tar.gz.
If you are connected to internet, just run:
install.packages("rvest")

Insallation failed on devtools::install_github("rstudio/rmarkdown")

I use R 3.4.3, And I need to install devtools::install_github("rstudio/rmarkdown"). But the following installation error comes up.
Downloading GitHub repo rstudio/rmarkdown#master
from URL https://api.github.com/repos/rstudio/rmarkdown/zipball/master
Installation failed: zip file 'C:\Users\Buster\AppData\Local\Temp\RtmpWyl4FP\file3bc6c571eec.zip' cannot be opened
Warning messages:
1: GitHub repo contains submodules, may not function as expected!
2: In utils::unzip(src, exdir = target) :
error 1 in extracting from zip file
How can I install this?
this has been resolved. I used devtools::install_url("http://cran.r-project.org/src/contrib/rmarkdown_1.9.tar.gz")
As explained in the README for rmarkdown:
If you are working within RStudio then you can simply install the
current release of RStudio (both the rmarkdown package and pandoc are
included).
If you want to use the rmarkdown package outside of RStudio then you
can install the package from CRAN as follows:
install.packages("rmarkdown")
This is a much more concise way of doing:
devtools::install_url("http://cran.r-project.org/src/contrib/rmarkdown_1.9.tar.gz")

Why do I get a syntax error in devtools::install_github?

I am new in working with linux. I am trying to analyse sequencing data using dropEst pipeline https://github.com/hms-dbmi/dropEst#dropreport. I want to run the DropReport and for that I need to install dropEstR package.
I tried by :
devtools::install_github('hms-dbmi/dropEst/dropestr' , dependencies = T)
as they suggest and I get as an error:
bash: syntax error near unexpected token
`'hms-dbmi/dropEst/dropestr','
Do you have any idea what should I do differently?
I think you are using the "wrong" shell. You have to use R/RStudio, when you want to use the devtools package. From CRAN:
Title Tools to Make Developing R Packages Easier
I just tried you command in RStudio but installation fails in the end:
ERROR: dependency 'Rcpp' is not available for package 'dropestr'
* removing 'C:/R/R-3.4.2/library/dropestr'
Installation failed: Command failed (1)
You have to run such script on RStudio for R. Import your project here and run it.
You can download it from enter link description here
Happy Coding.

problem when installing RTextTools for R

I was trying to install RTextTools package for R, but failed. Here is the output from the screen
> > install.packages("RTextTools")
Warning in install.packages("RTextTools") :
argument 'lib' is missing: using 'C:\Users\datamining\Documents/R/win-library/2.10'
--- Please select a CRAN mirror for use in this session ---
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.10
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘RTextTools’ is not available
What's the reason for this problem, and how to fix it? Thanks.
There are two distinct, but related, issues:
You are running version 2.10 of R which is two years old. CRAN supports only the current version with pre-built binaries. You could try installing from source.
RTextTools, as can be seen on its CRAN page also requires at least R version 2.13.
So in short: you should upgrade.
I have resolved the issue. I have Download RTextTools From Given Link.

https://cran.r-project.org/src/contrib/Archive/RTextTools/
and copy RTextTools_1.4.2.tar.gz file in project root folder then run this command in project folder in terminal
"R CMD INSTALL RTextTools_1.4.2.tar.gz"
After running this command I receive below error
"ERROR: dependencies ‘SparseM’, ‘randomForest’, ‘tree’, ‘e1071’, ‘ipred’, ‘caTools’, ‘maxent’, ‘glmnet’, ‘tau’ are not available for package ‘RTextTools’".
Now install each dependencies from RStudio or RConsole (Any Editor used by you) by simply running this code.
install.packages("caTools").
Install all 9 required packages One By One (In My Case it was 9 Packages Dependencies required by RTextTools) all packages will be installed except 'maxent'.
Now download maxent from the given link.
https://cran.r-project.org/src/contrib/Archive/maxent/.
and copy maxent_1.3.3.1.tar file in project folder then run this command in project folder in terminal.
"R CMD INSTALL maxent_1.3.3.1.tar"
Now For RTextTools Run this command again in Terminal.
"R CMD INSTALL RTextTools_1.4.2.tar.gz"
All is done Now..
But the Last Step is
Load the RTextTools using.
library(RTextTools)
You will see one more Error: Load SparseM Now Loading SparseM use code below.
library(SparseM)
and in the last Load RTextTools
library(RTextTools)
RTextTools is dependent on a number of packages, most of which require R 2.13+. You should always keep R updated to the latest version, since each update contains numerous bug fixes and performance enhancements.
If you can't install packages from repository or the packages are not available anymore, just follow this steps:
Install.packages("devtools")
check -- library("devtools")
install_github("cran/maxent")
install_github("cran/RTextTools")

Resources