I'm trying to re-run some code that worked well previously. When I enter my code, I get this error:
could not find function rpart
However, when I run the find.package function, I have it:
[1] "C:/Users/maltm/Documents/R/win-library/4.0/rpart"
I also get this warning:
package ‘rpart’ was built under R version 4.0.5
It also tells me I need the stats package, which the find.package function tells me I have. Here's the error message for that:
Error: package ‘stats’ could not be loaded`
In addition: Warning message:
package ‘rpart’ was built under R version 4.0.5
Warning: namespace ‘stats’ is not available and has been replaced
by .GlobalEnv when processing object ‘<unknown>’
I just reinstalled R and have the latest version (2021.09.0,Build 351; check for updates tells me I have the latest version), so am not sure what to do here. Thanks in advance for any guidance.
Related
I used RStudio to create an R package ('cryptArith'). The build went fine and all relevant R files are present and functional (checked independently). When I try to load the package and use the functions I get this:
install.packages('cryptArith')
Warning message:
package ‘cryptArith’ is not available (for R version 4.0.2)
I have been unable to find any information about the source of this error.
I'm new in R programming. Want a run little script for TTR package, but getting version error
Here is my code part
options(repos=(CRAN="https://CRAN.R-project.org/package=TTR"))
install.packages("https://CRAN.R-project.org/package=TTR")
and here is error I get
Warning: unable to access index for repository https://CRAN.R-project.org/package=TTR/src/contrib:
cannot open URL 'https://CRAN.R-project.org/package=TTR/src/contrib/PACKAGES'
Warning message: package 'https://CRAN.R-project.org/package=TTR' is not available (for R version 3.4.4)
Error in library(TTR) : there is no package called 'TTR'
but when I run TTR library from https://rdrr.io/snippets/ , it works well, and R version in the link is 3.4.4
How can I solve this problem?
EDIT: I see this question How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?, but can not find my solution
I tried it with your command, and i get the same error. But using the standard way with install.packages does the job.
You can install the package with:
install.packages('TTR', dependencies=TRUE, repos='http://cran.rstudio.com/')
Can somebody point me in the right direction here, I am using the caret package and I am trying to run a caretTheme but it keeps returning the error:
Error in caretTheme() : could not find function "caretTheme"
I tried install.packages('caretTheme') and receive the error
"Warning in install.packages :
package ‘caretTheme’ is not available (for R version 3.4.1 Patched)"
I have searched on github and cannot find the package listed there or am I able to find it onlinee to bruteforce install using devtools::
Can you find the package available for download anywhere?
Try installing developmental version:
devtools::install_github("topepo/caret/pkg/caret")
library(caret)
exists("caretTheme")
[1] TRUE
sessionInfo()$otherPkgs$caret$Version
"6.0-77"
Root of problem:
My environment is RevoREnt 7.3 that is tied with R 3.1.1.
I need to install tidyr package. tidyr needs DBI package.
I installed/loaded DBI (v0.5). R gave warning:
Warning message:
package ‘DBI’ (0.5) was built under R version 3.3.1
After installing/loading DBI (v0.5), my search help function was corrupted with error: i.e.,
"?? yay"in R console gave the following error:
"Error in `[<-`(`*tmp*`, , "name", value = sub("\\.[^.]*$", "", basename(vDB$File))) : subscript out of bounds"
Then, instead of Uninstall/Reinstall RevoREnt, I decided to save my broken RevoREnt (noticing that there are many R user facing corrupted search help function without any solution to mend).
I unload/uninstall DBI from R console, then I deleted the folder of DBI package from R library location via Windows Explorer. I re-run RevoREnt and write "??yay" in console:
My Help Browser (http://127.0.0.1:27971/doc/html/Search?pattern=yay) was opened
"The search string was "yay". No results found." appeared there.
That is: I saved my search help function without uninstalling/Re-installing RevoREnt.
What I did to solve/find:
1. Since I very needeed tidyr package, I decided to install/load DBI package that is compatible with my R 3.1.1. I went CRAN DBI (https://cran.r-project.org/web/packages/DBI/index.html)
There, it writes "Depends: R (≥ 2.15.0)" in DBI page.
Does this mean that DBI (v0.5) was built under R2.15.0?
2. I went to DBI's archieve: https://cran.r-project.org/src/contrib/Archive/DBI/
Tried to find one by one loading and checking the warnings in R console:
Warning message:
package ‘DBI’ (0.5) was built under R version 3.3.1
Warning message:
package ‘DBI’ (0.4) was built under R version 3.1.3
Warning message:
package ‘DBI’ (0.3.1) was built under R version 3.1.2
Eventually, by trial and error, I found DBI 0.3.1 does not corrupt my search help function though it is built under 3.1.2>3.1.1!
Then, I reversed back. This time DBI 0.4 also did not corrupt search help function unexpectedly. DBI 0.5 always continued to corrupt the search help function.
Isn't there any simple way of finding R version under which the packages were built?
The information you want is in the last column ("Built") of the output of installed.packages(), per https://stat.ethz.ch/R-manual/R-devel/library/utils/html/installed.packages.html.
.libPaths() # get the library location
installed.packages(lib.loc = "C://Revolution//R-Enterprise-7.3//R-3.1.1//library")
I am using R 3.2.2 and installed the mosaic package. I then used the fetchData function as follows:
data<-fetchData(1,c("Web_scraping","Data_mining"))
I get the following error:
Error: Use fetchData() from the `fetch' package instead.
When I try to install the fetch package, an error says:
Warning in install.packages :
package ‘fetch’ is not available (for R version 3.2.2)
I found documentation that the mosaic package was dropping fetchData in R 3.2.2, but couldn't find what package I should use to run the function properly.
Fetch
It appears that the fetch package is currently available via GitHub at https://github.com/ProjectMOSAIC/fetch.
Installation
To install fetch from GitHub:
Open up your R console
Install devtools (if not already installed) with this command*:
install.packages("devtools")
Type y if going through the devtools installer
Install fetch with this command:
devtools::install_github("ProjectMOSAIC/fetch")
Basic Usage
If successful, fetch should be accessible by requiring the fetch package
require("ProjectMOSAIC/fetch")
and calling fetchData() like this:
data <- fetch::fetchData( ... )
* Note: According to Etienne Low-Décarie, you'll need to have the make command available on your system before running the install.packages("devtools") command.
My students have been running into this problem trying to use the textbook code from Statistical Modeling: A Fresh Approach, this semester. I'm not familiar with the syntax used in the original question (with the number as the first argument), but this does not appear to be supported syntax in the fetch::fetchData() function. The workflow that we have been using to get around this (slightly simpler than summea's answer) is:
install.packages("devtools")
devtools::install_github("ProjectMOSAIC/fetch")
data <- fetch::fetchData("whickham.csv")
Note that I cannot reproduce the example in the original question, as I get different error/warning messages:
data<-fetch::fetchData(1,c("Web_scraping","Data_mining"))
With this as the error/warning:
Error in if (show.path) return(get("path", envir = .fetchEnvironment)) :
argument is not interpretable as logical
In addition: Warning message:
In if (show.path) return(get("path", envir = .fetchEnvironment)) :
the condition has length > 1 and only the first element will be used
I hope fetch is on its way to being on CRAN, and listed as a dependency of mosaic, as this is currently causing headaches in my class.