Using USABoundaries - r

I'm trying to use the USABoundaries package to draw maps and am having trouble downloading UsaBoundariesData. When I enter something like this
library(USAboundaries)
OH_cong <- us_congressional(states = "OH", resolution = "high")
I get this error message:
The USAboundariesData package needs to be installed.
Install the USAboundariesData package?
1: Yes
2: No
Selection: Yes
Installing the USAboundariesData package.
Installing package into ‘/home/rstudio-user/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
Error in value[[3L]](cond) :
Failed to install the USAboundariesData package.
Please try installing the package for yourself using the following command:
install.packages("USAboundariesData", repos = "http://packages.ropensci.org", type = "source")
> install.packages("USAboundariesData", repos = "http://packages.ropensci.org", type = "source")
Installing package into ‘/home/rstudio-user/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
Error in install.packages : error reading from connection
If anyone has any useful info that would be much appreciated!

Try this instead:
devtools::install_github("ropensci/USAboundariesData")

Related

How do i load non-tidyverse R package to Kaggle

I'm trying to upload a project that i worked on R, to Kaggle. But its refusing to load these packages
library(geosphere)
library(measurement)
It keeps giving me an error message -
Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified)
Then I have tried to download the latest R package from CRAN (R-4.2.1-win.exe), so i can manually specify the document path using the code below
install.packages("C:/Users/Da/Downloads/R-4.2.1-win.exe", repos = NULL, type = "source")
but that is not working as well. The error message is: -
Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is
unspecified)
Warning message in install.packages("‪C:/Users/Damilare/Downloads/R-4.2.1-win.exe", :
“installation of package ‘‪C:/Users/Da/Downloads/R-4.2.1-win.exe’ had non-zero exit status”
How do i load packages that are not a part of tidyverse to Kaggle?
Please help me, I'm new to Data Analytics.

Trouble installing the package geoR (Windows)

it seems that the package "geoR" was removed from the repository.
So after trying to install it manually with:
install.packages(file.choose(), repos=NULL, type="source")
Installing package into "geoR_1.8-1.zip"(as ‘lib’ is unspecified)package 'geoR' successfully unpacked and MD5 sums checkedError in utils:::unpackPkgZip(pkg, pkg_name, lib, libs_only, lock, reuse_lockdir = reuse_lockdir) :package 'geoR' not installed because it is not built for UCRTWarning in install.packages :installation of package ‘geoR_1.8-1.zip’ had non-zero exit status
I have the latest version of R (4.2.0).
So I've tried another command:
install.packages("geoR_1.8-1.zip", repos = NULL, type = "win.binary")
Installing package into ‘libpath’(as ‘lib’ is unspecified)package ‘geoR’ successfully unpacked and MD5 sums checkedError in install.packages : package ‘geoR’ not installed because it is not built for UCRT
So how do I make it work?
I've already tried to uninstall R, Rstudio, Rtools42 and all the folders associated...
After a long try, I came up with this:
If I try to install an older version of geoR,
install.packages("geoR_1.7-5.2.tar.gz", repos = NULL, type = "source")
Installing package into ‘C:/Users/.../AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
ERROR: dependencies 'splancs', 'RandomFields' are not available for package 'geoR'
* removing 'C:/Users/..../AppData/Local/R/win-library/4.2/geoR'
Warning in install.packages :
installation of package ‘geoR_1.7-5.2.tar.gz’ had non-zero exit status
So this seems a dependancies issue, and after installing splancs correctly, RandomFields (manually because there is no repository for it) give me this output after a long string (maybe the compilation):
make: *** [C:/PROGRA~1/R/R-42~1.0/etc/x64/Makeconf:257: brownresnick.o] Error 1
ERROR: compilation failed for package 'RandomFields'
* removing 'C:/Users/.../AppData/Local/R/win-library/4.2/RandomFields'
Warning message:
In install.packages(file.choose()) :
installation of package ‘C:/Users/rmish/Downloads/RandomFields_3.3.tar.gz’ had non-zero exit status
Somebody wants to help me?
Thanks in advance, I'm really stuck.
Both RandomFields and geoR are no longer available on CRAN, so you'll have to download their respective tar files. You'll also need to install the splancs package, which is available on CRAN.
install.packages("splancs")
Download the two other packages here:
http://www2.uaem.mx/r-mirror/src/contrib/RandomFields_2.0.66.tar.gz
https://cran.r-project.org/src/contrib/Archive/geoR/geoR_1.8-1.tar.gz
Install RandomFields first:
install.packages("C:/path/to/RandomFields_2.0.66.tar.gz", repos = NULL, type = "source")
And then geoR:
install.packages("C:/path/to/geoR_1.8-1.tar.gz", repos = NULL, type = "source")

rnaturalearthhires package installation error

I am trying to install the rnaturalearthhires package but I am getting many errors.
Here is the first error:
Installing the rnaturalearthhires package.
Installing package into ‘C:/Users/kkost/OneDrive/Dokumenti/R/win-library/4.0’
(as ‘lib’ is unspecified)
Error in value[3L] :
Failed to install the rnaturalearthhires package.
Please try installing the package for yourself using the following command:
install.packages("rnaturalearthhires", repos = http://packages.ropensci.org", type = "source")
Then I try the following code:
install.packages("rnaturalearthhires", repos = "http://packages.ropensci.org", type = "source")
And I get this:
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/kkost/OneDrive/Dokumenti/R/win-library/4.0’
(as ‘lib’ is unspecified)
**Error in install.packages : error reading from connection**
Then I try this code:
devtools::install_github("ropensci/rnaturalearthhires")
but end up getting this:
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘rlang’ 0.4.8 is already loaded, but >= 0.4.10 is required
I also try this code:
install_github("ropensci/rnaturalearthhires")
But I get this:
Error in install_github("ropensci/rnaturalearthhires") :
could not find function "install_github"
I found this isssue, it might help:
https://github.com/ropensci/rnaturalearthhires/issues/2
install.packages("devtools") # I guess you also need this
devtools::install_github("ropensci/rnaturalearthhires")
library("rnaturalearth")
devtools can take a looong time to compile and install for some users. installation directly from github can now be done with the remotes package.
remotes::install_github("ropensci/rnaturalearthhires")

Installation of factoextra package in R studio

I am trying to install factoextra package in R Studio (v.1.2.1335 on Mac), however, I get error messages for each of the several approaches I tried.
I tried simple installation as well as installing the package source from https://cran.r-project.org/web/packages/factoextra/index.html.
install.packages("factoextra")
install.packages("~/Desktop/factoextra_1.0.5.tar.gz", repos = NULL, type = "source")
package ‘factoextra’ is available as a source package but not as a binary
Warning in install.packages :
package ‘factoextra’ is not available (for R version 3.1.2)
When installing the package source I get an error message:
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2019a.1.0/zoneinfo/America/Toronto'
ERROR: dependency ‘ggpubr’ is not available for package ‘factoextra’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/factoextra’
Warning in install.packages :
installation of package ‘/Users/lihieder/Desktop/factoextra_1.0.5.tar.gz’ had non-zero exit status
I also tried installing package ggpubr but run into similar issues even when trying to install the source package for ggpubr.
Any ideas?
only use
install.packages("factoextra")

Bayesian Network with R

I am trying to build a Bayesian network model. However I am unable to install a suitable package. Tried gRain, bnlearn and Rgraphviz for plotting. I have tried in R 2.15 and 3.2
Following are the error messages :
library(gRain)
Loading required package: gRbase
Loading required package: graph
Error: package ‘graph’ could not be loaded
In addition: Warning message:
In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) :
there is no package called ‘graph’
> install.packages("graph")
Warning message:
package ‘graph’ is not available (for R version 2.15.3)
Same for R 3.2.1
> install.packages("graph")
(as ‘lib’ is unspecified)
Warning message:
package ‘graph’ is not available (for R version 3.2.1)
> install.packages("Rgraphviz")
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning messages:
1: In open.connection(con, "r") : unable to resolve 'cran.r-project.org'
2: package ‘Rgraphviz’ is not available (for R version 3.2.1)
> install.packages("Rgraphviz")
(as ‘lib’ is unspecified)
Warning message:
package ‘Rgraphviz’ is not available (for R version 2.15.3)
Other info for the model
1) No of variables - 17
2) Type of variables - discrete/continuous
The packagesgraph, RBGL and Rgraphviz are not on CRAN but on bioconductor.
To install these packages, execute
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(c("graph", "RBGL", "Rgraphviz"))
Then install the packages from CRAN in the usual way:
install.packages("gRain", dependencies=TRUE)
See also the gRain installation instructions.
For R version 3.5 or greater, you can install Bioconductor packages using BiocManager.
Please see: https://bioconductor.org/install.
I installed them using the following code:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.10")
BiocManager::install(c("gRbase", "RBGL", "Rgraphviz", "gRain"))

Resources