could not find function "validate_key" using MODISTools in R - r

I am getting the below error and don't know what is causing it.
I am following this vignette to learn MODISTools.
https://cran.r-project.org/web/packages/MODISTools/vignettes/modistools-vignette.html
library(MODISTools)
products <- mt_products()
Warning: namespace ‘cachem’ is not available and has been replaced
by .GlobalEnv when processing object ‘<unknown>’
Error in validate_key(key) : could not find function "validate_key"

I had the same problem.
validate_key() is a function from the cachem package. It seems like MODISTools depends on this package but not always installs it. For me, installing and loading the cachem package manually resolved the error.

Related

Problem loading SjPlot after installing parameters

I'm getting the almost the same error as the previous post, but the answers there are not working for me. I was able to use sjPlot with no issues until this afternoon when I installed parameters and sandwich and clubsandwich. I don't know what else I can do to get over this.
the error:
> library(sjPlot)
Error: package or namespace load failed for ‘sjPlot’:
object ‘standard_error_robust’ was not exported by 'namespace:parameters'
In addition: Warning message:
package ‘sjPlot’ was built under R version 4.1.3
Any help would be much appreciated. Updating parameters didn't solve it. Meanwhile, is there an equivalent function for tab_model()? (since I cannot use it...). Thanks in advance.
devtools::install_github("strengejacke/sjPlot") worked for me :D

Autospearman in R

Did anyone used the AutoSpearman function from "software-analytics/Rnalytica" package and worked for him? I keep having errors while loading the package. You can find here the documentation of AutoSpearman function.

Conflict of Packages in RStudio, detach() fails to work

I am currently doing Logistic Regression on the 'birthwt' data set found within R. This data is found within the package 'MASS'.
However, when I use library(MASS) to retrieve the data, it masks the function of select() from the dplyr package. I use this function almost immediately in my analysis.
After loading the data, I attempt
detach("package:MASS", unload = TRUE)
but I am met with
‘MASS’ namespace cannot be unloaded:
namespace ‘MASS’ is imported by ‘pbkrtest’, ‘car’, ‘lme4’ so cannot be unloaded
I wold really love to sort this out as I have completed all my necessary analysis on the data, but was met with this issue when attempting to knit.
Thank you in advance for any help!
You shouldn't choose unload = TRUE. The default is unload = FALSE, and that's what you need.
Here's the explanation:
In R, packages can be "loaded", which makes them available to other packages that import functions from them. They can also be "attached", which puts them on the search list, so that they are available to the user in the console. If a package is attached, it needs to be loaded, but the reverse is not true.
So if you run detach("package:MASS"), you will remove it from the search list, and in the console, running select() will no longer find the function in MASS. It will still be loaded, so will be available to the other packages that need it.
By the way, using the prefix form MASS::select() or dplyr::select() will work regardless of whether either or both packages are in your search list.

Function readLAS not found

In spite of having the packages "rLiDAR" and "lidR" already installed in my computer, and having R Studio updated, when I use the function readLAS(), it doesn´t work. What could be the problem?
My line of code:
LAS<-readLAS(lasfile,short=TRUE)
Error: could not find function "readLAS"
Looks like the package is probably not installed properly and/or the required magrittr package is missing (if you are using lidR).
install.packages("lidR")
install.packages("magrittr")
library(lidR)
las = readLAS("yourpath/yourfile.las")
summary(las)
I'm pretty sure the short=TRUE option is only available in the rLidar package, not lidR.
https://cran.r-project.org/web/packages/lidR/lidR.pdf
https://cran.r-project.org/web/packages/rLiDAR/rLiDAR.pdf

What does this mean in lme4: function 'dataptr' not provided by package 'Rcpp'

I'm trying to do LMM using lme4, and this message pops up:
Error in initializePtr() :
function 'dataptr' not provided by package 'Rcpp'
What should I do?
After a while, I got it.
1) Reinstall the latest version of Rcpp is the solution.
2) If you are not using lme4, but you also have this problem ("function 'dataptr' not provided by package 'Rcpp'") in combination with dyn.load(), it might be worth noting do not forget to include
library(Rcpp)
or
require(Rcpp)
on your code before
dyn.load("your_shared_lib.so")
Source:
building_shared_libs_with_Rcpp

Resources