R Shiny - Error: there is no package called ‘shinyjs’ - r

My app works perfectly when I run it locally, but when I host it in shinyapps.io this error comes out:
An error has occurred
The application failed to start.
Error in value[3L] : there is no package called ‘shinyjs’
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> Anonymous
I have two more apps online with the same ui.R and server.R layouts and both work fine. Even if I avoid the code involving shinyjs, it shows the app in the browser but the same error appears in the app log with the package openxlsx. The other two almost-identical apps working perfect got me completely lost.

In my experience, the issue happens in RStudio projects with a DESCRIPTION file, when the offending package (e.g. shinyjs) is NOT included in the Imports section of the DESCRIPTION file.

I know this answer is late but in case is useful, here it is:
1.- Open a terminal and run: sudo R
2.- I installed shinyjs: install.packages("shinyjs", dependencies=TRUE)
3.- Create shinyjs directory: mkdir /usr/local/lib/R/site-library/shinyjs
4.- cd /usr/local/lib/R/site-library/shinyjs
4.- copy the shinyjs folder from the active username home R directory:
cp /home/username/R/x86_64-pc-linux-gnu-library/3.5/shinyjs/* -r .
Go to your web browsers and it will open your app.
Note. Be sure to change username for correct value and remember to set the privileges.

When you deploy your app on shinyapps.io the serve has to understand where the packages were installed from. The two most common sources of package installations probably are:
CRAN
Github
Looking at the documentation you see that Github packages must be installed with devtools. I have had the same issue you face because I had packages installed with remotes or pak, simply reinstall the packages locally you need using either install.packages for CRAN versions and devtools for dev versions and re-deploy:
install.packages("openxlsx")
# install.packages("devtools")
devtools::install_github("daattali/shinyjs")

Related

lazy-load database '../R/NymbulCredentials.rdb' is corrupt

I am trying to install a package from GitHub in support of deploying an app to shinyapps.io. If I download the package onto my machine, then it installs without issue. However, if I execute the command (in RStudio):
devtools::install_github(repo="rlmoore0/NMDeploy", subdir="NymbulCredentials")
then I get an error message: Error in (function (n) :
lazy-load database '../R/NymbulCredentials.rdb' is corrupt
This GitHub repo is public, so anyone can try running this command from within R/RStudio with devtools installed. I am on a Windows box running R 3.6.3, Win10.
Any suggestions?
I have looked at questions from other people with similar problems and based on the responses to them, I have tried:
Closing and restarting R/RStudio
Executing the command devtools::unload("NymbulCredentials")
Executing the command unloadNamespace("NymbulCredentials")
Removing the installation library the package is being installed to as referenced by .libPaths() and trying a fresh directory as the installation location.
The error still persists.

Warning in install.packages lib is not writeable in R studio

Extremely frustrated that I am not able to install the following package:
install.packages('tseries')
after I run this command I get the following message:
Would you like to use a personal library instead?
I click "yes"
Then it attempts to download a bunch of things from R URLs.
Then I get the following error where it mentions
Warning in install packages: lib = "My path" is not writable
I have read multiple things that mentioned that I need to set myself as administrator with full control/access.
I have done so and allowed full control to my personal account.
I then restart R and try to install the tseries package again but I get the same exact errors as mentioned above.
System windows 10
R version 3.6

R: Error in install.packages : cannot open the connection

I was trying to install the package RINDSEL but I am unable to install it and I keep getting the following error:
Error in install.packages : cannot open the connection
I downloaded the package from:
rindsel_1.0_2.zip | Integrated Breeding Platform
and loaded it from the directory. Other packages from the directory can be installed but just not this one.
Is the package corrupt or could there be any other error?
I would really be grateful for any help. Thanks in advance
Rename the zip file RinSel Software into Rindsel. That's the name specified in the discription file.
Then, you can install the package in R with the command
install.packages("C:/path/to/Rindsel.zip",repos=NULL,type="win.binary")
That works fine... at first (!!!).
Problem with the Rindsel package is. It is quite old. It was build with R 2.13.1. Therefore, if you want to load the library which would be the next step to use the package in R you will get the error:
Problems building package (Error: "package has been build before R-3.0.0")
My suggestion: Contact the authors of the package and ask them if they can either provide the source file that you can build the package by yourself or if they can bundle the Rindsel package with a newer R version.
(Or you could try to hunt down an old R version and see if you can get the thing running with an old R... However, I would not seriously suggest to do that. It would probably result in conflicting dependencies with the other required packages...)
EDIT 15-02-2018: OP asked if one can build an R package with sources that are presumeably the Rindsel source files.
Yes, basically, you could do that. You would have to make a your own description and namespace file and put the source file in the R folder than invoke the command in R to build it....
But it's not neccessary with the script files provided by the link the OP posted.
OP, just run the scripts in R! It's quite easy.
Download the zip-file and extract it on your machine.
Go to that directory. The R command would be
setwd('path/to/your/directory')
Than run the R script, e.g, the KNIndex.r. It's simple:
source('KNIndex.r')
Then the script will run and produce some output / prompts.
For future readers,
I was able to fix the error by running RStudio with administrative privileges to get the command to work.
If that does not fix it, you might wish to try
Installing "r tools" if that is not installed already. That can be downloaded from
https://cran.r-project.org/bin/windows/Rtools/
Download a relevant package that you are trying to install (e.g., tidyverse_1.3.0.zip) from https://cran.rstudio.com/
and install that from local path
It can also be installed directly from the web using install.packages("https://cran.rstudio.com/bin/windows/contrib/4.0/tidyverse_1.3.0.zip")
I had the same problem. R was not able to extract and compile the package files to the default installation directory for some system-specific reasons (not R related).
I was able to fix this by specifying the installation directory of the package lib using:
install.packages("your package", lib = 'path/to your/required/installation/directory')
You can then load the package by specifying the lib.loc option while loading it:
library('your package', lib.loc='path/to your/required/installation/directory')
A better solution:
Create a new environment variable (if you are using windows) R_LIBS_USER with the following directory path/to your/required/installation/directory.
This will change the default installation directory of the packages and make it easier to load and install them without specifying the location everytime.

Build & Reload in RStudio on Windows: devtools::document() says devtools not found

When I click "Build & Reload" on the Build tab within RStudio, I get the following error:
==> devtools::document(roclets=c('rd', 'collate', 'namespace'))
Error in loadNamespace(name) : there is no package called 'devtools'
Calls: suppressPackageStartupMessages ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
Exited with status 1.
But when I just enter devtools::document(roclets=c('rd', 'collate', 'namespace')) directly into the console, it works.
In addition, if I uncheck "Build & Reload" under "Automatically roxygenize when running:" in the Build Tools -> Roxygen config, the error disappears.
I've installed the latest devtools with devtools::install_github("hadley/devtools"). I'm using Windows.
If anyone has an suggestions, thank you in advance!
I had to uncheck "Build & Reload" under "Automatically reoxygenize when running:" in the Build Tools -> Roxygen Configure menu. Installing devtools in the program files/r/3.2.3/lib helped, but it still wanted all the dependencies there as well. Using packrat didn't seem to help either..
Here's a convenient solution based on mathematical.coffee's comment:
Just run this from Rstudio:
writeLines("install.packages('devtools', repos = 'https://cran.rstudio.com/')", "inst.R")
system("Rscript --vanilla inst.R")
I encountered this problem multiple times and also with other packages related to devtools (e.g. knitr in the devtools::check()). As it was getting on my nerves, I tried to install devtools in other location of .libPaths(), i.e. in the first standard one (in my case it was /usr/local/lib/R/site-library/). It was telling me that I needed sudo rights. I gave them (as I was utterly annoyed by this) but still, it is needed a large number of dependencies. Therefore, my practical solution was to sudo-copy my "special" R library folder into the standard one. The following code fixed all my problems:
sudo cp -rf /home/myname/R/x86_64-pc-linux-gnu-library/3.4/* /usr/local/lib/R/site-library/
I would like to point out that this is the only effective solution I found. Even so, it lacks elegance and I would definitely prefer if the guys from Rstudio provide a way to link Rstudio to a personally-defined library. It was already my case on startup and I had to add my personal lib to .libPaths() in the file Rprofile.site which is run every time on R startup, but this did not solve the above problem anyhow.
I encounter the same issue, what I solve in the latest version of Rstudio is :
Build -> Configure Build Tools -> Build Tools -> Press Configure Button -> Uncheck "Source
and binary package builds"

R's devtools - install from github with "configure" file

I have an R package on github that uses a "configure" script (since some of the C code depends on GSL libraries). I try installing the package using github_install() function from devtools package and get the error:
(as ‘lib’ is unspecified)
* installing *source* package ‘wrightscape’ ...
ERROR: 'configure' exists but is not executable -- see the 'R Installation and Administration Manual'
Not sure what to do -- are there such a thing as execute permissions for a file on github? is this a devtools issue or a configuration issue? (Installing the package from source works fine for me). The package is here. https://github.com/cboettig/wrightscape
This is now fixed in the latest version of devtools (0.7).
Git does not manage file permissions directly. It is usually the responsibility of a build or install script to adjust permissions correctly once the bits are delivered from git. There are third party tools that can help with this. See the discussion on SO question Retaining file permissions with Git.
Hope this helps.
I had a similar issue which was caused by my /tmp dir being mounted noexec, and solved by setting a different TMPDIR, as explained here
export TMPDIR=~/tmp

Resources