web-dev-qa-db-fra.com

Comment installer les derniers rlang et dplyr?

Je veux exécuter un script qui commence par

library(dplyr)  
library(lubridate)  
library(ggplot2)  

J'ai commencé avec r-base-core Et r-cran-lubridate Installés régulièrement. J'ai eu:

Error in mutate_impl(.data, dots) : 
  Evaluation error: `as_dictionary()` is defunct as of rlang 0.3.0.
Please use `as_data_pronoun()` instead.

(le code lui-même n'utilise pas mutate_impl il semble que ce soit ce problème https://github.com/r-lib/rlang/issues/674 , suggérant une mise à jour de dplyr

la version r était R version 3.4.4 (2018-03-15) pour dplyr, je ne savais pas comment le découvrir.

J'ai donc changé la source comme décrit ailleurs: ajouté deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ À /etc/apt/sources.list

Sudo apt-get update
Sudo apt-get install r-base
Sudo apt-get install r-cran-dplyr
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 r-cran-dplyr : Depends: r-api-3.4
                Depends: r-cran-assertthat but it is not going to be installed
                Depends: r-cran-bindrcpp (>= 0.2) but it is not going to be installed
                Depends: r-cran-glue (>= 1.1.1) but it is not going to be installed
                Depends: r-cran-magrittr but it is not going to be installed
                Depends: r-cran-pkgconfig but it is not going to be installed
                Depends: r-cran-rlang (>= 0.1.2) but it is not going to be installed
                Depends: r-cran-r6 but it is not going to be installed
                Depends: r-cran-rcpp (>= 0.12.7) but it is not going to be installed
                Depends: r-cran-tibble (>= 1.3.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

L'Iran

Sudo apt-get remove r-*
Sudo apt-get clean
Sudo apt-get autoclean
Sudo apt-get update
Sudo apt-get install r-base
Sudo apt-get install r-cran-dplyr

mais rien n'a changé.
L'installation à partir de R Shell ne fonctionne pas non plus:

> install.packages("dplyr")
Installing package into ‘/home/_/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘pillar’, ‘purrr’, ‘bindrcpp’, ‘tibble’, ‘tidyselect’

trying URL 'https://cloud.r-project.org/src/contrib/pillar_1.3.0.tar.gz'...
downloaded 100 KB

trying URL 'https://cloud.r-project.org/src/contrib/purrr_0.2.5.tar.gz'...
downloaded 123 KB

trying URL 'https://cloud.r-project.org/src/contrib/bindrcpp_0.2.2.tar.gz'...
downloaded 10212 bytes

trying URL 'https://cloud.r-project.org/src/contrib/tibble_1.4.2.tar.gz'...
downloaded 107 KB

trying URL 'https://cloud.r-project.org/src/contrib/tidyselect_0.2.5.tar.gz'...
downloaded 21 KB

trying URL 'https://cloud.r-project.org/src/contrib/dplyr_0.7.8.tar.gz'...
downloaded 702 KB

* installing *source* package ‘pillar’ ...
** package ‘pillar’ successfully unpacked and MD5 sums checked
** R
** byte-compile and prepare package for lazy loading
Error : package ‘rlang’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
ERROR: lazy loading failed for package ‘pillar’
* removing ‘/home/_/R/x86_64-pc-linux-gnu-library/3.5/pillar’
* installing *source* package ‘bindrcpp’ ...
** package ‘bindrcpp’ successfully unpacked and MD5 sums checked
** libs
g++  -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I. -I"/home/_/R/x86_64-pc-linux-gnu-library/3.5/plogr/include" -I"/usr/local/lib/R/site-library/Rcpp/include"    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oUvOgu/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.o
g++  -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I. -I"/home/_/R/x86_64-pc-linux-gnu-library/3.5/plogr/include" -I"/usr/local/lib/R/site-library/Rcpp/include"    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oUvOgu/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c create.cpp -o create.o
g++  -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I. -I"/home/_/R/x86_64-pc-linux-gnu-library/3.5/plogr/include" -I"/usr/local/lib/R/site-library/Rcpp/include"    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oUvOgu/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c plogr.cpp -o plogr.o
g++  -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I. -I"/home/_/R/x86_64-pc-linux-gnu-library/3.5/plogr/include" -I"/usr/local/lib/R/site-library/Rcpp/include"    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-oUvOgu/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c test.cpp -o test.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o bindrcpp.so RcppExports.o create.o plogr.o test.o -L/usr/lib/R/lib -lR
installing to /home/t/R/x86_64-pc-linux-gnu-library/3.5/bindrcpp/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Error : package ‘Rcpp’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
ERROR: lazy loading failed for package ‘bindrcpp’
* removing ‘/home/_/R/x86_64-pc-linux-gnu-library/3.5/bindrcpp’
ERROR: dependency ‘pillar’ is not available for package ‘tibble’
* removing ‘/home/_/R/x86_64-pc-linux-gnu-library/3.5/tibble’
ERROR: dependency ‘tibble’ is not available for package ‘purrr’
* removing ‘/home/_/R/x86_64-pc-linux-gnu-library/3.5/purrr’
ERROR: dependency ‘purrr’ is not available for package ‘tidyselect’
* removing ‘/home/_/R/x86_64-pc-linux-gnu-library/3.5/tidyselect’
ERROR: dependencies ‘bindrcpp’, ‘tibble’, ‘tidyselect’ are not available for package ‘dplyr’
* removing ‘/home/_/R/x86_64-pc-linux-gnu-library/3.5/dplyr’

The downloaded source packages are in
    ‘/tmp/Rtmpxim56P/downloaded_packages’
Warning messages:
1: In install.packages("dplyr") :
  installation of package ‘pillar’ had non-zero exit status
2: In install.packages("dplyr") :
  installation of package ‘bindrcpp’ had non-zero exit status
3: In install.packages("dplyr") :
  installation of package ‘tibble’ had non-zero exit status
4: In install.packages("dplyr") :
  installation of package ‘purrr’ had non-zero exit status
5: In install.packages("dplyr") :
  installation of package ‘tidyselect’ had non-zero exit status
6: In install.packages("dplyr") :
  installation of package ‘dplyr’ had non-zero exit status
> 
5
user2740

Je n'ai pas non plus pu installer dplyr dans Ubuntu 18.04. J'avais R version 3.6.1, qui a apparemment causé le problème.

J'ai suivi cette solution et j'ai fait ce qui suit

Sudo add-apt-repository ppa:marutter/c2d4u3.5
Sudo apt update
Sudo apt install r-cran-dplyr

qui a fait l'affaire.

1
Rasmus