choroplethr package in R will not load [duplicate] - r

This question already has answers here:
Rcpp package doesn't include Rcpp_precious_remove
(2 answers)
Closed last year.
Loading required package: acs
Loading required package: stringr
Loading required package: XML
Attaching package: ‘acs’
The following object is masked from ‘package:base’:
apply
Error: package or namespace load failed for ‘choroplethr’:
.onLoad failed in loadNamespace() for 'units', details:
call: udunits_init(path)
error: function 'Rcpp_precious_remove' not provided by package 'Rcpp'
In addition: Warning messages:
1: package ‘choroplethr’ was built under R version 4.0.5
2: package ‘acs’ was built under R version 4.0.5
3: package ‘XML’ was built under R version 4.0.5

As #jose pointed out in the comments, this can likely be solved by updating your packages. The error you copied is quite long, but the key part appears to be this:
error: function 'Rcpp_precious_remove' not provided by package 'Rcpp'
I am actually the author of choroplethr, and I have no idea what this function is, or why Rcpp is being loaded at all when you load choroplethr. But here we are.
When I paste that error message into DuckDuckGo, the first hit I get is this stackoverflow question.
There the solution appears to simply be typing:
install.packages('Rcpp')
library(Rcpp)
I recommend trying that and seeing if it works.
Regardless of whether that alone solves your problem, I also recommend following the other suggestion #jose made. Namely, typing:
update.packages()
And trying again.
Dependency management in R is a pain. It is probably worth getting into the habit of typing update.packages() when you get an error you don't recognize to see if it magically solves your problem.

Related

Error showing while loading "dplyr" package in R.

ibrary("dplyr")
Gives the following errors.
Error: package or namespace load failed for ‘dplyr’ in library.dynam(lib, package, package.lib):
shared object ‘rlang.so’ not found
In addition: Warning message:
S3 methods ‘$.rlang_data_pronoun’, ‘$.rlang_fake_data_pronoun’, ‘$<-.quosures’, ‘$<-.rlang_data_pronoun’, ‘[.quosures’, ‘[.rlang_data_pronoun’, ‘[.rlang_envs’, ‘[.stack’, ‘[<-.quosures’, ‘[[.rlang_data_pronoun’, ‘[[.rlang_fake_data_pronoun’, ‘[[<-.quosures’, ‘[[<-.rlang_data_pronoun’, ‘Math.quosure’, ‘Ops.quosure’, ‘Summary.quosure’, ‘as.character.quosure’, ‘as.list.quosures’, ‘c.quosures’, ‘c.rlang_envs’, ‘conditionMessage.rlang_error’, ‘format.rlang_trace’, ‘length.rlang_data_pronoun’, ‘length.rlang_fake_data_pronoun’, ‘mean.quosure’, ‘median.quosure’, ‘names.rlang_data_pronoun’, ‘names.rlang_fake_data_pronoun’, ‘print.frame’, ‘print.quosure’, ‘print.quosures’, ‘print.rlang_data_pronoun’, ‘print.rlang_envs’, ‘print.rlang_error’, ‘print.rlang_fake_data_pronoun’, ‘print.rlang_lambda_function’, ‘print.rlang_trace’, ‘print.rlang_zap’, ‘ [... truncated]
But while specify the lib path as .libPaths( "/usr/lib/R/library/" ) and then loading library will load the dplyr package and does not gives error.
I would like to know actually what is the issue behind this.
Also install.package("dplyr") on R console is also not working.
It gives error like:
Error in library.dynam(lib, package, package.lib) :
shared object ‘rlang.so’ not found
ERROR: lazy loading failed for package ‘dplyr’
There is a problem with the "dplyr" package. This issue is due to the the latest rlang installed on a version of R for which binaries are no longer built....
Try restarting your R-Studio
https://cran.r-project.org/bin/macosx/ : Install Suitable versions in the link according
to your system requirements and update the R on your device
Try updating your R to the latest version
Alternate Answer:
Would recommend waiting until the binaries are available on CRAN for dplyr > 0.7.4 before making a breaking change that requires 0.7.6
install.packages("dplyr")
Installing package into ‘ ...
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
dplyr 0.7.4 0.7.7 TRUE
Do you want to install from sources the package which needs compilation?
y/n:

Failing to install Kieran Healy's 'socviz' package from github using devtools

I am trying to follow along with the online data viz resource by Kieran Healy (socviz.co), and have had minimal trouble setting things up to do so. I cannot seem to successfully install his 'socviz' package. This is the code Healy suggests:
devtools::install_github('kjhealy/socviz')
This returns:
ERROR: dependency 'rlang' is not available for package 'socviz'
* removing 'C:/Users/annem/OneDrive/Documents/R/win-library/3.4/socviz'
Installation failed: Command failed (1)
I tried removing and reinstalling 'rlang', but I still received the same error. I have also tried restarting R.
When reinstalling 'rlang', I get the following:
package ‘rlang’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘rlang’
And when trying to load:
library(rlang)
Error in library(rlang) : there is no package called ‘rlang’
I'm using R v 3.4.2 on Windows 10.
I'm relatively new to R, so if there's a seemingly obvious solution (or you think it could be solved by doing something I've already done) let me know!
It's very possible I'm making a silly mistake, but I haven't found it myself. Any help is appreciated!
Turns out the problem was in how I was removing 'rlang'. I was attempting to using remove.packages() while the package was loaded into my session. I deleted it from my machine directly, but as Tung mentioned, using the remove.packages() command works as long as it is not loaded into the current R session.
Lesson learned--thanks!

choroplethr package in R won't load

I am trying to load the choroplethr package in R and keep getting an error message that I can't troubleshoot or understand. If someone could please provide me with a workaround to fix this that would be appreciated.
install.packages("choroplethr")
install.packages("choroplethrMaps")
library(choroplethr)
library(choroplethrMaps)
Loading required package: acs
Loading required package: stringr
Loading required package: XML
Attaching package: acs
The following object is masked from package:base:
apply
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘htmlTable’
In addition: Warning messages:
1: package ‘choroplethr’ was built under R version 3.2.5
2: package ‘stringr’ was built under R version 3.2.5
3: package ‘XML’ was built under R version 3.2.5
Error: package or namespace load failed for ‘choroplethr’
Thank you,
Kelly
I am the package author and unfortunately I often have users report errors like this.
Technically, when you install an R package all of the packages needed to run that package are supposed to automatically get installed. In practice, however, that does not always happen. The key part of the first error message you report is this:
Error ... there is no package called ‘htmlTable’
In response to that error message I would simply manually install the htmlTable package and then reinstall choroplethr:
install.packages("htmlTable")
install.packages("choroplethr")
Reading the comments from your initial question it seems like you were able to get past this error message but then ran into another one. Again, the key part of that error message seems to be the following:
Error ... there is no package called ‘rlang’
I would address this error in the same way. Ie type:
install.packages("rlang")
install.packages("choroplethr")
Again, I have no idea why errors like this seem to sporadically occur when people try to install choroplethr (and presumably other packages as well). However, the fix that always seems to work is manually installing the package which R complains it cannot find.

Rcmndr plugin not running

I am trying to run this rcmndr plugin for my class and it's not working. I installed all the necessary packages and it appeared to install correctly but I am getting this package or namespace load failure. The GUI appears for a split second when I enter the library command, then disappears with the error. It seems to be an issue with the namespace and .onattach but I couldn't find any existing answers or resources for this issue.
https://cran.r-project.org/web/packages/RcmdrPlugin.BCA/index.html
> library(RcmdrPlugin.BCA)
Loading required package: Rcmdr
Loading required package: splines
Loading required package: RcmdrMisc
Loading required package: car
Loading required package: sandwich
Rcmdr Version 2.2-3
Loading required package: BCA
Warning: package 'BCA' was built under R version 3.2.3
Loading required package: flexclust
Warning: package 'flexclust' was built under R version 3.2.3
Loading required package: grid
Loading required package: lattice
Loading required package: modeltools
Loading required package: stats4
Error : .onAttach failed in attachNamespace() for 'RcmdrPlugin.BCA', details:
call: get(Menus[m, 5])
error: object 'importRODBCtable' not found
In addition: Warning messages:
1: package ‘RcmdrPlugin.BCA’ was built under R version 3.2.3
2: package ‘Rcmdr’ was built under R version 3.2.3
3: package ‘RcmdrMisc’ was built under R version 3.2.3
4: package ‘car’ was built under R version 3.2.3
Error: package or namespace load failed for 'RcmdrPlugin.BCA'
I got alternative to run this plugin in R commander.
Open R Commander by using:
library(Rcmdr)
R Commander dialogue box will appear.
In R Script load BCA library-
lapply(list('BCA', 'splines', 'RcmdrMisc', 'car', 'sandwich', 'flexclust', 'grid','lattice','modeltools','stats4','RODBC'), require, character.only = TRUE)
Click on Submit button.
If you don't have RODBC package (which is not there in my case), install it separately and then run above commands. To install use:
install.packages("RODBC")
And now you exactly have what you will get after loading RcmdrPlugin.BCA library.
I faced a similar situation. Having tried a bunch of things - none worked - I finally uninstalled R and deleted the remaining files from under the "Program Files" directory in Windows. I then reinstalled R and RcmdrPlugin.BCA and this time it worked.
You could also refer to this URL for help http://r.789695.n4.nabble.com/Unable-to-run-RcmdrPlugin-survival-using-3-2-2-with-Windows-10-td4711796.html

Running strapply in the absence of tcltk in R

I have a data frame with one column carrying a list variable. The list variable contains duplicate elements which I want to remove. The following is the code that I am using:
library(gsubfn)
Loading required package: proto
Could not load tcltk. Will use slower R code instead.
resp$secu <- as.character(lapply(strapply(resp[[7]], "\\w")), unique)
I am using R 3.2.0 version on mac. I tried loading tcltk manually without success:
library(tcltk)
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: fun(libname, pkgname)
error: X11 library is missing: install XQuartz from xquartz.macosforge.org
Error: package or namespace load failed for ‘tcltk’
I uninstalled library tcltk and tried re-installing but couldn't:
Warning in install.packages :
package ‘tcltk’ is not available (for R version 3.2.0)
I could execute the code and R started without any error messages. But it had taken an hour for a 65k row list to remove the duplicates and the processing yet to complete. Is there a way to improve the speed of strapply without using tcltk library?

Resources