I am trying to use this source from github.
devtools::source_url('https://raw.githubusercontent.com/brooksandrew/Rsenal/master/R/bin.R')
I could use this and work with it till few hours back. but now it gives me the following error
Error in loadNamespace(name) : there is no package called ‘Rsenal’
The code is still there in the provided url. I did re run the following two commands but still not working.
install.packages("devtools")
library("devtools")
What should I do to fix this issue?
I believe your issue is arising because you are sourcing functions that live inside a package, that is meant to be distributed as a package.
Instead of using devtools::source_url(), try this:
devtools::install_github('brooksandrew/Rsenal')
library("Rsenal")
Once the package is properly installed, all of the primary functions (such as binCat()) should be available for use.
I believe you ran into this error because some functions within the package probably depend on others that are not found within the two files you manually sourced. So when those lines are executed, R looks for the Rsenal package file and does not find them.
Further troubleshooting would require a reproducible example.
Related
I am trying to load a package in RStudio from GitHub but I get an error.
I have also updated all the packages in order to see if this was the problem but I still get the same error. I have a MAC pc (I don't know if this may cause some problems).
The link of the package that I would like to load is:
https://github.com/andrewraim/COMMultReg
and there is written that in order to load it I need to run
library(devtools)
install_github("andrewraim/COMMultReg")
But when I run the second line I get as error:
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘COMMultReg’ in namespaceExport(ns, exports):
undefined exports: d_cmb, d_cmb_sample, d_cmm, d_cmm_sample, gunterize, loglik_score_fim_cmm, normconst_cmb, normconst_cmm, r_cmb
Errore: loading failed
Esecuzione interrotta
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/COMMultReg’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/n0/4lmr1lrj7qqfylmh6s8qx0nr0000gn/T//RtmpldrmHr/file72e1e4469d/COMMultReg_0.1.0.tar.gz’ had non-zero exit status
Can somebody help me telling me what to do?
Thanks!!
The package has no function named d_cmb, but it tries to export that function. That's what the error message says, and it's true.
I think the reason for this error is that the author used Roxygen2 to generate his NAMESPACE file where the exports are declared, but that file is out of sync with the contents of the package.
It's possible this happened because the author forgot to commit a new file containing the new code. In that case, the best solution is to contact the author, and point out the issue.
Alternatively, it may have happened because at one time there was a d_cmb function, but the author removed it, without updating the NAMESPACE file. This one you might be able to fix yourself.
To fix this, you'll need to run Roxygen2 yourself, which is a little more complicated than just installing what's on Github. Here are the steps:
Fork the package to your own Github account if you have one. (This step is optional, but it makes some later steps easier.)
Download the source for the package. In RStudio, the quickest way to do this is to create a new project using Version Control, Git, and give the URL
of your forked copy, or the original URL if you skipped that.
Run Roxygen2 on the package. In RStudio, you do this by choosing "Document" in the "More" menu of the Build tab.
Try to build it. If you're lucky, it will now build properly. If not, fix the next problem.
This is very important: send your changes back to the original author. If you forked the package, this is easy; if not, figure out a way to do it.
this is the maintainer of the COMMultReg package. I didn't know about this thread until now, but it sounds like you were able to get started from the answer by user2554330.
The functions d_cmb, d_cmb_sample, etc are supposed to be exported. I think the problem may have been that, at the time of the question, I did not have src/RcppExports.cpp and R/RcppExports.R checked into Github. This seems to be necessary to use install_github on a package with exported Rcpp functions. Those were checked in around 8 months ago. (Coincidentally not long after this question was posted?)
Please let me know if you still having trouble with the install. Otherwise, enjoy the package!
I am new to R. I am using version 4.0.2 (windows) and it was working well until I tried to use "dplyr" and "tidyverse" packages. I am able to download both packages but when I try to load them I get the error below. I have tried reinstalling R and Rstudio, I have tried update.packages() and then restarted Rstudio but still I get this error. If I try require(dplyr), then I still this error.
Can anyone please help me?
> library(dplyr) Error: package or namespace load failed for ‘dplyr’ in namespaceExport(ns, exports): undefined exports: as_glue, backtick, double_quote, glue, glue_col, glue_collapse, glue_data, glue_data_col, glue_data_safe, glue_data_sql, glue_safe, glue_sql, identity_transformer, single_quote, trim In addition: Warning message: S3 methods ‘+.glue’, ‘[.glue’, ‘[[.glue’, ‘as.character.glue’, ‘as_glue.character’, ‘as_glue.default’, ‘as_glue.glue’, ‘print.glue’ were declared in NAMESPACE but not found
This became too long for a comment, but it might be because the library dplyr is part of the tidyverse library. tidyverse is much bigger, and includes a bunch of different libraries/packages https://www.tidyverse.org/packages/
Do you still get the error if you load dplyr without tidyverse? In other words does the error only come when you load the second package, regardless of which is the second? It might be telling you that it can't load the package twice, but I am not sure, I haven't seen this specific error message.
I just wanted to share that I managed to fix this problem. I realised that the folder where the packages were being stored was being backed up in OneDrive, ie. OneDrive was in the file pathway. So I unlinked my OneDrive, re-installed R, Rtools & Rstudio and then both dplyer and tidyverse started working for me. I don't know why I didn't have that error with other packages but this seems to have fixed it...
I had the same problem and the issue was, specifically, that the 'digest' package was stored into my OneDrive. The issue was solved (after three days of struggle) when I created a local library (~/local-lib) for the package that required ggplot2 (called, "factoextra").
install.packages("ggplot2", lib = "C:/Users/MY_USER_NAME/R/local-lib")
library("ggplot2",lib = "C:/Users/MY_USER_NAME/R/local-lib")
install.packages("digest", lib = "C:/Users/MY_USER_NAME/R/local-lib")
library("digest",lib = "C:/Users/MY_USER_NAME/R/local-lib")
install.packages("factoextra", lib = "C:/Users/MY_USER_NAME/R/local-lib")
library("factoextra",lib = "C:/Users/MY_USER_NAME/R/local-lib")
Another more permanent solution is published here, but I only have limited administrative rights to my computer, so I couldn't pull this one off. If you are hampered by admin rights, you can potentially run your R environment in Anaconda, which also isn't a perfect solution, but for those of us in universities with stringent IT departments, that seems to work alright.
I had a similar problem with the civis package and determined that installing the roxygen2 package first would allow the civis installation to complete. It still gave a bunch of namespace warnings, and I'm having to call civis functions using the civis:: prefix, but other than that it seems to work.
I doubt this is the only cause of this kind of error, but if you're having problems it might be worth a try!
I'm new to R so I hope this isn't incredibly obvious. I created a package that contains two functions. I provided documentation using roxygen2 for each of the functions, documented and built the package as well as installed and restarted multiple times. I also pushed it up to github and have done everything I can think of to do, yet I cannot access the help files that I created. I always receive this error:
No documentation for ‘myfunc’ in specified packages and libraries: you
could try ‘??myfunc’
Not only is ?myfunc not working, but when I attempt to install my own package to my own RStudio console, but I also receive this error:
Warning in install.packages : package ‘yourpackage*’ is not
available (for R version 3.6.1)
What exactly is going wrong here, and how can I attempt to fix it? I've built packages before and this time I've followed all the same steps I've been taught to use and have used in the past, but for some reason, I'm being met with these errors. I would appreciate any and all help you all have to offer. Thank you in advance!
I have a problem with the R package "gridExtra". Everything is ok, when I go into R and load it, but when I execute a python script, which among others also loads this package, everything stops. I don't understand it, since I checked the library and the right library is selected.
It's a little complicated, because the script is from someone else. It can be accessed from here: https://github.com/guigolab/ggsashimi/blob/master/sashimi-plot.py. The package is loaded at row 430. Loading the previous packages was no problem, after installing them into the custom library. During the python script, a custom R script is generated and executed. Within this R script, the package is loaded usign the function library(gridExtra).
The error message is:
Error in library(gridExtra) : there is no package called ‘gridExtra’
Execution halted
I checked, if the generated R script really accesses the right library and it does, so there is no problem with the library selection.
I created my own package with the RStudio build tools and building/loading the package via the build tools works fine. My functions run as desired and the documentation works fine as well.
Writing the package as a source file works fine, too, as well as installing the package from source. Though, when I execute functions after installing the package from source I get an "R code execution error" as well as the error message
Error in fetch(key) : cannot allocate memory block of size 2.7 Gb
The size of the memory block in the error message varies every time.
So the problem is that I can't run any functions after installing the package from source. I need to be able to share the package as a source file though.
Does anyone have experience with this kind of problem? Is it related to writing the package as a source file? I could not find anything so far.
Additional info: When I run the "check package" command, everything works fine except for one error checking the given examples. The examples should not be an issue though, right?