Trouble accessing help documentation for a package I created - r

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!

Related

Install LiDAR Terrestrial Point Cloud Processing of Forest Data package does work

I try install TreeLS package, but i receive this message.
install.packages("TreeLS")
Message:
Installing package into ‘C:/Users/Matheus Pacheco/AppData/Local/R/win-library/4.2’
Warning in install.packages :
package ‘TreeLS’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
I found that the package is not present in CRAN anymore, and i try install from source, using:
install.packages("TreeLS", repos = "https://cran.r-project.org/src/contrib/Archive/TreeLS/TreeLS_2.0.2.tar.gz", repo = NULL, type="source")
But, some functions in the package, doesn't work.
I would be grateful if someone can help me. My final paper in PhD depends on it.
Thanks!
I'm afraid that if you're using a retired package, there is little help to get unless you try to fix it yourself. The question become too general.
But, some functions in the package, doesn't work.
Contact package developer, there is probably another package that include what you need, or his code might have been moved into some other package. He/She would know.
Perhaps someone can help you if you pull out the parts you need.
last resort (not recommend), downgrade to a compatible R version.

"package or namespace load failed" error in loading R package from GitHub

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!

Error in namespaceExport(ns, exports) when loading dyplyr and tidyverse

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!

How to update locally created R package without reinstalling

I created an R package using this tutorial. The package loads just fine when called but requires a bit debugging. After debugging my script, I used devtools::update_packages("new_package") to fix the changes, but I receive the following error: Skipping 1 packages not available: new_package (interestingly, new_package shows up when I call installed.packages()).
I'm able to update my package by reinstalling with devtools::install("new_package"), but for simple fixes this doesn't seem very efficient. Perhaps there is another way? I appreciate any help or insight.
EDIT for clarification:
I understand the package needs to be reloaded to update changes, but reloading the package using library(mypackage) (after detaching the package or starting a new session) does not accomplish this while devtools::update_packages("path/to/mypackage") does. Per the tutorial, I decided to install my package using devtools::install(). Is this because the process of installing my homebrew package requires setting up repository for updates?

can't use sjPlot in R

I followed the instructions on https://strengejacke.github.io/sjPlot/ to install the package but despite downloading and installing all the packages, I can't use them because I keep getting the error message
could not find function "sjP.lmer"
does anyone know where this is coming from? I'd be happy to provide more details but I don't even know where to look for them...

Resources