Je n'ai pas pu tester sur toutes les distros Linux, mais gsub
semble se comporter différemment sous Ubuntu :
url <- "http://thinkr.fr/"
gsub("(.*)/", "\\1", url)
#Returns
# on mac, Windows, CentOS
[1] "http://thinkr.fr"
# On Ubuntu (plain and Mint)
[1] "http:/thinkr.fr"
Le retour d'Ubuntu http:/
où tous les autres retournent http://
.
Vous savez pourquoi ?
Voici les informations de session pour le Linux Mint qui produit la deuxième sortie :
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18.2
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C LC_TIME=fr_FR.UTF-8
[4] LC_COLLATE=fr_FR.UTF-8 LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stringr_1.3.0 tidyr_0.8.0 dplyr_0.7.4 purrr_0.2.4 glue_1.2.0 attempt_0.2.0
[7] jsonlite_1.5 httr_1.3.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 assertthat_0.2.0 R6_2.2.2 magrittr_1.5 pillar_1.2.1
[6] stringi_1.1.7 rlang_0.2.0 curl_3.0 neo4r_0.0.0.9000 bindrcpp_0.2
[11] tools_3.4.3 igraph_1.2.1 yaml_2.1.17 compiler_3.4.3 pkgconfig_2.0.1
[16] tidyselect_0.2.4 bindr_0.1 tibble_1.4.2
> extSoftVersion()
zlib bzlib
"1.2.8" "1.0.6, 6-Sept-2010"
xz PCRE
"5.1.0alpha" "8.38 2015-11-23"
ICU TRE
"" "TRE 0.8.0 R_fixes (BSD)"
iconv readline
"glibc 2.23" "6.3"
BLAS
"/usr/lib/libblas/libblas.so.3.6.0"
> pcre_config()
UTF-8 Unicode properties JIT stack
TRUE TRUE TRUE TRUE