Dependencies in R package - r

I recently tried to create a R package and in the DESCRIPTION file I saw that in the "depends" field I can insert the other packages that I need, like this,
Depends: R (> = 3.2.2), readxl, ltm
The "readxl" package has not a problem, but for "ltm" I get this error:
Error in (function (dep_name, dep_ver = NA, dep_compare = NA):
Dependency package ltm not available.
Calls: suppressPackageStartupMessages ... <Anonymous> -> load_all ->
load_depends -> mapply -> <Anonymous>
Execution halted
Exited with status 1.
How can I fix the problem?

I had the same problem with a package yesterday.
1) Reinstall R.
2) Reinstall package with DEPENDENCIES=TRUE
3) If it doesn't work, install dependencies from source.

Related

Knitting error when converting to pdf on rstudio

I keep getting this error when I try to knit to PDF using R Markdown. It has worked before, and I tried installing the package contrib.url but it says it is not available for my version. Any suggestions?
Error in contrib.url(repos, "source") : trying to use CRAN without setting a mirror calls : <Anonymous> ... with visible -> eval -> eval -> install.packages -> contrib.url Execution halted
The error usually comes when you don't set a mirror in the install.packages command. You probably have a call to install.packages somewhere in your markdown document.
Try the following:
install.packages("aPackage",repos = "http://cran.us.r-project.org")
So just add the repos part. You could of course also just install the package before usage and remove the install.packages line completely from your rmarkdown.

R - Installation of shiny fails after upgrade to 4.0.2

I upgraded to R 4.0.2 today, and also updated my copy of RStudio. While I've been updating my packages I've found that shiny won't install. Whenever I try to install shiny I get the following message...
Error in as.list.environment(base::getNamespace("shiny"), all.names = TRUE) :
lazy-load database 'H:/My Documents/R/win-library/4.0/shiny/R/shiny.rdb' is corrupt
Calls: <Anonymous> ... withCallingHandlers -> <Anonymous> -> <Anonymous> -> as.list.environment
Execution halted
*** arch - x64
Error in as.list.environment(base::getNamespace("shiny"), all.names = TRUE) :
lazy-load database 'H:/My Documents/R/win-library/4.0/shiny/R/shiny.rdb' is corrupt
Calls: <Anonymous> ... withCallingHandlers -> <Anonymous> -> <Anonymous> -> as.list.environment
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing 'H:/My Documents/R/win-library/4.0/shiny'
Warning in install.packages :
installation of package ‘shiny’ had non-zero exit status
I get this error regardless of whether I just type "install.packages('shiny')" and peace out or if I download the tar.gz and try to install from a local directory. The same error happens when I specify to download an older version of shiny, so I'm pretty sure it's not a problem with the file I'm trying to install. Restarting RStudio does nothing, which is the only advice I could find online for shiny installation problems.
Has anyone else had any problems with installing shiny since upgrading to the newest version of R? Any workarounds?

R file won't knit, saying readxl package doesn't exist

I'm using RStudio, and trying to knit my file to hand in my assignment. I installed the package "readxl" to read in a couple of excel files, and it worked fine in the actual coding of the assignment. But when I go to knit the file, I keep getting the error:
Error in library(readxl) : there is no package called 'readxl'
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval ->
library
Execution halted
This is the code in question:
install.packages("tidyverse",repos = "http://cran.us.r-project.org")
library(tidyverse)
install.packages("readxl",repos = "http://cran.us.r-project.org")
library(readxl)
This has been frustrating me for over an hour and I just can't fix it. I can see the readxl package to the right of the console, in the "packages" tab. Any help will be much appreciated

Linux: error in curl - Can't install R-packages with devtools::install_github()

I want to install the R-package Leaflet on my R-server(linux) from GitHub because it is more up-to-date than the current CRAN-version. I’m using the following R-script to do this:
library(httr)
library(devtools)
set_config(use_proxy(url = "xxx", port = xxxx))
devtools::install_github("rstudio/leaflet")
But it is showing the following error:
if(!require('devtools')) install.packages('devtools')
Loading required package: devtools
devtools::install_github('rstudio/leaflet')
Downloading GitHub repo rstudio/leaflet#master
from URL https://api.github.com/repos/rstudio/leaflet/zipball/master
Error in curl::curl_fetch_memory(url, handle = handle) :
Couldn't connect to server
Calls: <Anonymous> ... request_fetch -> request_fetch.write_memory -> <Anonymous> -> .Call
Execution halted
When I do install packages from CRAN, there are no issues at all. But I need the newest version of Leaflet which is only at GitHub...
Is there a solution to fix this? Is it because I'm using a proxy?
Regards,
Joris

RQuantLib OSX installation issue

followed the steps below to install QuantLib on OSX and it went smoothly:
http://quantlib.org/install/macosx.shtml
Then trying to install RQuantLib. First download the source, unzipped and executed the following command from Terminal, with the error messages below:
$ R CMD INSTALL RQuantLib
Loading required package: DBI
Loading required package: rJava
Error in .jfindClass(as.character(driverClass)[1]) : class not found
Calls: JDBC -> is.jnull -> .jfindClass
Execution halted
Tried directly in R, same issue:
> install.packages("RQuantLib")
Loading required package: DBI
Loading required package: rJava
Error in .jfindClass(as.character(driverClass)[1]) : class not found
Calls: JDBC -> is.jnull -> .jfindClass
Execution halted
Warning in install.packages :
installation of package ‘RQuantLib’ had non-zero exit status
Tried reinstalling RJDBC in R, no success either. Somehow I can't get this to work, and am stuck now.
Any help is highly appreciated, thanks.

Resources