explore-libraries

test repo for Jenny Bryan's class rstudio::conf 2018

View the Project on GitHub

01_explore-libraries_jenny.R

minnier Wed Jan 31 14:05:59 2018

## how jenny might do this in a first exploration
## purposely leaving a few things to change later!

Which libraries does R search for packages?

.libPaths()
## [1] "/Library/Frameworks/R.framework/Versions/3.4/Resources/library"
## let's confirm the second element is, in fact, the default library
.Library
## [1] "/Library/Frameworks/R.framework/Resources/library"
library(fs)
path_real(.Library)
## /Library/Frameworks/R.framework/Versions/3.4/Resources/library

Installed packages

library(tidyverse)
## ── Attaching packages ────────────────────────────────────── tidyverse 1.2.1 ──

## ✔ ggplot2 2.2.1.9000     ✔ purrr   0.2.4     
## ✔ tibble  1.4.2          ✔ dplyr   0.7.4     
## ✔ tidyr   0.7.2          ✔ stringr 1.2.0     
## ✔ readr   1.1.1          ✔ forcats 0.2.0

## Warning: package 'tibble' was built under R version 3.4.3

## ── Conflicts ───────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
ipt <- installed.packages() %>%
  as_tibble()

## how many packages?
nrow(ipt)
## [1] 673

Exploring the packages

## count some things! inspiration
##   * tabulate by LibPath, Priority, or both
ipt %>%
  count(LibPath, Priority)
## # A tibble: 3 x 3
##   LibPath                                                 Priority       n
##   <chr>                                                   <chr>      <int>
## 1 /Library/Frameworks/R.framework/Versions/3.4/Resources… base          14
## 2 /Library/Frameworks/R.framework/Versions/3.4/Resources… recommend…    15
## 3 /Library/Frameworks/R.framework/Versions/3.4/Resources… <NA>         644
##   * what proportion need compilation?
ipt %>%
  count(NeedsCompilation) %>%
  mutate(prop = n / sum(n))
## # A tibble: 3 x 3
##   NeedsCompilation     n   prop
##   <chr>            <int>  <dbl>
## 1 no                 344 0.511 
## 2 yes                279 0.415 
## 3 <NA>                50 0.0743
##   * how break down re: version of R they were built on
ipt %>%
  count(Built) %>%
  mutate(prop = n / sum(n))
## # A tibble: 5 x 3
##   Built     n    prop
##   <chr> <int>   <dbl>
## 1 3.0.0     1 0.00149
## 2 3.4.0   378 0.562  
## 3 3.4.1   100 0.149  
## 4 3.4.2   145 0.215  
## 5 3.4.3    49 0.0728

Reflections

## reflect on ^^ and make a few notes to yourself; inspiration
##   * does the number of base + recommended packages make sense to you?
##   * how does the result of .libPaths() relate to the result of .Library?

Going further

## if you have time to do more ...

## is every package in .Library either base or recommended?
all_default_pkgs <- list.files(.Library)
all_br_pkgs <- ipt %>%
  filter(Priority %in% c("base", "recommended")) %>%
  pull(Package)
setdiff(all_default_pkgs, all_br_pkgs)
##   [1] "abind"                            
##   [2] "acepack"                          
##   [3] "addinslist"                       
##   [4] "ade4"                             
##   [5] "AER"                              
##   [6] "affxparser"                       
##   [7] "affy"                             
##   [8] "affyio"                           
##   [9] "affyPLM"                          
##  [10] "airway"                           
##  [11] "amap"                             
##  [12] "Amelia"                           
##  [13] "animation"                        
##  [14] "annotate"                         
##  [15] "AnnotationDbi"                    
##  [16] "AnnotationFilter"                 
##  [17] "AnnotationHub"                    
##  [18] "apcluster"                        
##  [19] "ape"                              
##  [20] "arm"                              
##  [21] "aroma.light"                      
##  [22] "arrayQualityMetrics"              
##  [23] "ash"                              
##  [24] "assertthat"                       
##  [25] "atus"                             
##  [26] "babynames"                        
##  [27] "backports"                        
##  [28] "base64"                           
##  [29] "base64enc"                        
##  [30] "baySeq"                           
##  [31] "bbmle"                            
##  [32] "beadarray"                        
##  [33] "BeadDataPackR"                    
##  [34] "beanplot"                         
##  [35] "beeswarm"                         
##  [36] "bestglm"                          
##  [37] "betareg"                          
##  [38] "BH"                               
##  [39] "BiasedUrn"                        
##  [40] "bibtex"                           
##  [41] "bindr"                            
##  [42] "bindrcpp"                         
##  [43] "Biobase"                          
##  [44] "BiocGenerics"                     
##  [45] "BiocInstaller"                    
##  [46] "BiocParallel"                     
##  [47] "BiocStyle"                        
##  [48] "biomaRt"                          
##  [49] "biomformat"                       
##  [50] "Biostrings"                       
##  [51] "biovizBase"                       
##  [52] "BiSeq"                            
##  [53] "bit"                              
##  [54] "bit64"                            
##  [55] "bitops"                           
##  [56] "blob"                             
##  [57] "blockmodeling"                    
##  [58] "blockrand"                        
##  [59] "blogdown"                         
##  [60] "bookdown"                         
##  [61] "BPSC"                             
##  [62] "brew"                             
##  [63] "broman"                           
##  [64] "broom"                            
##  [65] "BSgenome"                         
##  [66] "bsseq"                            
##  [67] "bsseqData"                        
##  [68] "bumphunter"                       
##  [69] "Cairo"                            
##  [70] "calibrate"                        
##  [71] "callr"                            
##  [72] "car"                              
##  [73] "caret"                            
##  [74] "caTools"                          
##  [75] "cba"                              
##  [76] "cellranger"                       
##  [77] "checkmate"                        
##  [78] "chron"                            
##  [79] "cli"                              
##  [80] "clipr"                            
##  [81] "clisymbols"                       
##  [82] "cmprsk"                           
##  [83] "cobs"                             
##  [84] "coda"                             
##  [85] "coin"                             
##  [86] "colorspace"                       
##  [87] "colourpicker"                     
##  [88] "combinat"                         
##  [89] "CombinePValue"                    
##  [90] "commonmark"                       
##  [91] "CompQuadForm"                     
##  [92] "config"                           
##  [93] "corrplot"                         
##  [94] "countrycode"                      
##  [95] "cowplot"                          
##  [96] "crayon"                           
##  [97] "crosstalk"                        
##  [98] "curl"                             
##  [99] "cvAUC"                            
## [100] "CVST"                             
## [101] "cvTools"                          
## [102] "data.table"                       
## [103] "DBI"                              
## [104] "dbplyr"                           
## [105] "ddalpha"                          
## [106] "DDRTree"                          
## [107] "debugme"                          
## [108] "DEDS"                             
## [109] "DelayedArray"                     
## [110] "dendextend"                       
## [111] "densityClust"                     
## [112] "DEoptimR"                         
## [113] "desc"                             
## [114] "DESeq"                            
## [115] "DESeq2"                           
## [116] "destiny"                          
## [117] "devtools"                         
## [118] "DiagrammeR"                       
## [119] "dichromat"                        
## [120] "digest"                           
## [121] "dimRed"                           
## [122] "diptest"                          
## [123] "discretization"                   
## [124] "distillery"                       
## [125] "docthis"                          
## [126] "doParallel"                       
## [127] "doRNG"                            
## [128] "dotCall64"                        
## [129] "downloader"                       
## [130] "dplyr"                            
## [131] "drc"                              
## [132] "DrImpute"                         
## [133] "DRR"                              
## [134] "DSIExplore"                       
## [135] "DSS"                              
## [136] "DT"                               
## [137] "dynamicTreeCut"                   
## [138] "e1071"                            
## [139] "earth"                            
## [140] "EBSeq"                            
## [141] "EDASeq"                           
## [142] "edgeR"                            
## [143] "ellipse"                          
## [144] "emrselect"                        
## [145] "enc"                              
## [146] "EnsDb.Mmusculus.v79"              
## [147] "ensembldb"                        
## [148] "epiR"                             
## [149] "estimability"                     
## [150] "evaluate"                         
## [151] "exactRankTests"                   
## [152] "explainr"                         
## [153] "extrafont"                        
## [154] "extrafontdb"                      
## [155] "extRemes"                         
## [156] "ezknitr"                          
## [157] "faraway"                          
## [158] "fastcluster"                      
## [159] "fastICA"                          
## [160] "FDb.InfiniumMethylation.hg19"     
## [161] "fdrtool"                          
## [162] "ff"                               
## [163] "fields"                           
## [164] "fit.models"                       
## [165] "fivethirtyeight"                  
## [166] "flexdashboard"                    
## [167] "flexmix"                          
## [168] "FNN"                              
## [169] "fontBitstreamVera"                
## [170] "fontLiberation"                   
## [171] "fontquiver"                       
## [172] "forcats"                          
## [173] "foreach"                          
## [174] "formatR"                          
## [175] "formattable"                      
## [176] "Formula"                          
## [177] "fpc"                              
## [178] "fs"                               
## [179] "futile.logger"                    
## [180] "futile.options"                   
## [181] "gage"                             
## [182] "gageData"                         
## [183] "gam"                              
## [184] "gapminder"                        
## [185] "gclus"                            
## [186] "gcrma"                            
## [187] "gdata"                            
## [188] "gdtools"                          
## [189] "gee"                              
## [190] "geepack"                          
## [191] "genefilter"                       
## [192] "geneLenDataBase"                  
## [193] "geneplotter"                      
## [194] "GeneticsDesign"                   
## [195] "GenomeInfoDb"                     
## [196] "GenomeInfoDbData"                 
## [197] "GenomicAlignments"                
## [198] "GenomicFeatures"                  
## [199] "GenomicRanges"                    
## [200] "genoset"                          
## [201] "GEOquery"                         
## [202] "GGally"                           
## [203] "ggbeeswarm"                       
## [204] "ggdendro"                         
## [205] "ggExtra"                          
## [206] "ggformula"                        
## [207] "ggplot2"                          
## [208] "ggplot2movies"                    
## [209] "ggpubr"                           
## [210] "ggrepel"                          
## [211] "ggsci"                            
## [212] "ggsignif"                         
## [213] "ggThemeAssist"                    
## [214] "ggthemes"                         
## [215] "ggvis"                            
## [216] "gh"                               
## [217] "git2r"                            
## [218] "glmnet"                           
## [219] "glmpath"                          
## [220] "globaltest"                       
## [221] "glue"                             
## [222] "gmodels"                          
## [223] "GO.db"                            
## [224] "googledrive"                      
## [225] "googlesheets"                     
## [226] "googleVis"                        
## [227] "goseq"                            
## [228] "gower"                            
## [229] "gplots"                           
## [230] "graph"                            
## [231] "gridBase"                         
## [232] "gridExtra"                        
## [233] "gridSVG"                          
## [234] "grpreg"                           
## [235] "GSEABase"                         
## [236] "gtable"                           
## [237] "gtools"                           
## [238] "gutenbergr"                       
## [239] "Gviz"                             
## [240] "gWidgets"                         
## [241] "haven"                            
## [242] "HDF5Array"                        
## [243] "hdrcde"                           
## [244] "heatmap3"                         
## [245] "heatmaply"                        
## [246] "here"                             
## [247] "hexbin"                           
## [248] "HGNChelper"                       
## [249] "hgu133plus2cdf"                   
## [250] "highcharter"                      
## [251] "highlight"                        
## [252] "highr"                            
## [253] "Hmisc"                            
## [254] "hms"                              
## [255] "hoardr"                           
## [256] "hom.Mm.inp.db"                    
## [257] "hrbrthemes"                       
## [258] "HSMMSingleCell"                   
## [259] "htmlTable"                        
## [260] "htmltools"                        
## [261] "htmlwidgets"                      
## [262] "httpuv"                           
## [263] "httr"                             
## [264] "hunspell"                         
## [265] "hwriter"                          
## [266] "ICC"                              
## [267] "igraph"                           
## [268] "IHW"                              
## [269] "illuminaio"                       
## [270] "impute"                           
## [271] "infer"                            
## [272] "influenceR"                       
## [273] "ini"                              
## [274] "interactiveDisplayBase"           
## [275] "ipred"                            
## [276] "IRanges"                          
## [277] "irlba"                            
## [278] "irr"                              
## [279] "iterators"                        
## [280] "janeaustenr"                      
## [281] "janitor"                          
## [282] "jsonlite"                         
## [283] "kableExtra"                       
## [284] "KEGGREST"                         
## [285] "kernlab"                          
## [286] "klaR"                             
## [287] "km.ci"                            
## [288] "KMsurv"                           
## [289] "knitcitations"                    
## [290] "knitr"                            
## [291] "ks"                               
## [292] "labeling"                         
## [293] "laeken"                           
## [294] "Lahman"                           
## [295] "lambda.r"                         
## [296] "lars"                             
## [297] "lasso2"                           
## [298] "latticeExtra"                     
## [299] "lava"                             
## [300] "lazyeval"                         
## [301] "leaps"                            
## [302] "learnr"                           
## [303] "LiblineaR"                        
## [304] "limma"                            
## [305] "limSolve"                         
## [306] "Linnorm"                          
## [307] "lme4"                             
## [308] "lmerTest"                         
## [309] "Lmoments"                         
## [310] "lmtest"                           
## [311] "locfit"                           
## [312] "lokern"                           
## [313] "lpSolve"                          
## [314] "lpsymphony"                       
## [315] "lsmeans"                          
## [316] "lubridate"                        
## [317] "lumi"                             
## [318] "magrittr"                         
## [319] "mapdata"                          
## [320] "mapproj"                          
## [321] "maps"                             
## [322] "markdown"                         
## [323] "MAST"                             
## [324] "Matching"                         
## [325] "MatchIt"                          
## [326] "matlab"                           
## [327] "MatrixModels"                     
## [328] "matrixStats"                      
## [329] "maxLik"                           
## [330] "maxstat"                          
## [331] "mclust"                           
## [332] "mcmc"                             
## [333] "MCMCpack"                         
## [334] "mdsr"                             
## [335] "memisc"                           
## [336] "memoise"                          
## [337] "MetabolAnalyze"                   
## [338] "MetaSKAT"                         
## [339] "methyAnalysis"                    
## [340] "methylumi"                        
## [341] "microRNA"                         
## [342] "mime"                             
## [343] "minfi"                            
## [344] "miniUI"                           
## [345] "minpack.lm"                       
## [346] "minqa"                            
## [347] "misc3d"                           
## [348] "miscTools"                        
## [349] "MiST"                             
## [350] "MixAll"                           
## [351] "mlbench"                          
## [352] "mnormt"                           
## [353] "ModelMetrics"                     
## [354] "modelr"                           
## [355] "modeltools"                       
## [356] "moments"                          
## [357] "monocle"                          
## [358] "mosaic"                           
## [359] "mosaicCore"                       
## [360] "mosaicData"                       
## [361] "mouse430a2.db"                    
## [362] "mouse430a2cdf"                    
## [363] "msir"                             
## [364] "multcomp"                         
## [365] "multicool"                        
## [366] "multtest"                         
## [367] "munsell"                          
## [368] "mvoutlier"                        
## [369] "mvtnorm"                          
## [370] "naniar"                           
## [371] "ncdf4"                            
## [372] "networkD3"                        
## [373] "NHANES"                           
## [374] "nleqslv"                          
## [375] "nloptr"                           
## [376] "NMF"                              
## [377] "nnls"                             
## [378] "NOISeq"                           
## [379] "nor1mix"                          
## [380] "nortest"                          
## [381] "numDeriv"                         
## [382] "nycflights13"                     
## [383] "officer"                          
## [384] "okcupiddata"                      
## [385] "oligo"                            
## [386] "oligoClasses"                     
## [387] "oneKP"                            
## [388] "openair"                          
## [389] "openssl"                          
## [390] "org.Hs.eg.db"                     
## [391] "org.Mm.eg.db"                     
## [392] "outliers"                         
## [393] "packrat"                          
## [394] "pacman"                           
## [395] "pander"                           
## [396] "pbkrtest"                         
## [397] "pcaMethods"                       
## [398] "pcaPP"                            
## [399] "pcvsuite"                         
## [400] "pd.hta.2.0"                       
## [401] "pd.mogene.2.0.st"                 
## [402] "pd.mta.1.0"                       
## [403] "pd.rabgene.1.0.st"                
## [404] "penalized"                        
## [405] "permute"                          
## [406] "pheatmap"                         
## [407] "phyloseq"                         
## [408] "pillar"                           
## [409] "pkgconfig"                        
## [410] "pkgmaker"                         
## [411] "PKI"                              
## [412] "plogr"                            
## [413] "plotly"                           
## [414] "plotmo"                           
## [415] "plotrix"                          
## [416] "pls"                              
## [417] "plyr"                             
## [418] "png"                              
## [419] "polspline"                        
## [420] "powerGWASinteraction"             
## [421] "powerSurvEpi"                     
## [422] "ppcor"                            
## [423] "prabclus"                         
## [424] "pracma"                           
## [425] "praise"                           
## [426] "preprocessCore"                   
## [427] "prettydoc"                        
## [428] "prettyunits"                      
## [429] "printr"                           
## [430] "pROC"                             
## [431] "processx"                         
## [432] "prodlim"                          
## [433] "profvis"                          
## [434] "progress"                         
## [435] "ProtGenerics"                     
## [436] "proto"                            
## [437] "proxy"                            
## [438] "pryr"                             
## [439] "pscl"                             
## [440] "psych"                            
## [441] "purrr"                            
## [442] "purrrlyr"                         
## [443] "pwr"                              
## [444] "qap"                              
## [445] "qlcMatrix"                        
## [446] "qqman"                            
## [447] "quadprog"                         
## [448] "quantmod"                         
## [449] "quantreg"                         
## [450] "qvalue"                           
## [451] "R.cache"                          
## [452] "R.methodsS3"                      
## [453] "R.oo"                             
## [454] "R.utils"                          
## [455] "R2HTML"                           
## [456] "R6"                               
## [457] "rafalib"                          
## [458] "randomForest"                     
## [459] "rappdirs"                         
## [460] "rARPACK"                          
## [461] "RBGL"                             
## [462] "RColorBrewer"                     
## [463] "Rcpp"                             
## [464] "RcppArmadillo"                    
## [465] "RcppEigen"                        
## [466] "RcppRoll"                         
## [467] "RCurl"                            
## [468] "readr"                            
## [469] "readxl"                           
## [470] "recipes"                          
## [471] "RefManageR"                       
## [472] "registry"                         
## [473] "rematch"                          
## [474] "rematch2"                         
## [475] "remedy"                           
## [476] "repmis"                           
## [477] "repr"                             
## [478] "reprex"                           
## [479] "repurrrsive"                      
## [480] "reshape"                          
## [481] "reshape2"                         
## [482] "revealjs"                         
## [483] "RGA"                              
## [484] "rgenoud"                          
## [485] "rgexf"                            
## [486] "rgl"                              
## [487] "RgoogleMaps"                      
## [488] "Rgraphviz"                        
## [489] "rhdf5"                            
## [490] "rhesuscdf"                        
## [491] "rJava"                            
## [492] "rjson"                            
## [493] "RJSONIO"                          
## [494] "rlang"                            
## [495] "rlist"                            
## [496] "rmarkdown"                        
## [497] "Rmisc"                            
## [498] "rms"                              
## [499] "RMTstat"                          
## [500] "RMySQL"                           
## [501] "RNASeqPower"                      
## [502] "RnaSeqSampleSize"                 
## [503] "RnaSeqSampleSizeData"             
## [504] "rngtools"                         
## [505] "robCompositions"                  
## [506] "robust"                           
## [507] "robustbase"                       
## [508] "ROCR"                             
## [509] "Rook"                             
## [510] "ROTS"                             
## [511] "roxygen2"                         
## [512] "RPostgreSQL"                      
## [513] "rprojroot"                        
## [514] "RPushbullet"                      
## [515] "rrcov"                            
## [516] "Rsamtools"                        
## [517] "rsconnect"                        
## [518] "RSpectra"                         
## [519] "RSQLite"                          
## [520] "rstudioapi"                       
## [521] "rsvd"                             
## [522] "rtkore"                           
## [523] "rtracklayer"                      
## [524] "Rtsne"                            
## [525] "Rttf2pt1"                         
## [526] "RUVSeq"                           
## [527] "rversions"                        
## [528] "rvest"                            
## [529] "S4Vectors"                        
## [530] "samplesize"                       
## [531] "sandwich"                         
## [532] "sbfc"                             
## [533] "scales"                           
## [534] "scater"                           
## [535] "scatterplot3d"                    
## [536] "scDD"                             
## [537] "scde"                             
## [538] "SCnorm"                           
## [539] "scran"                            
## [540] "selectr"                          
## [541] "seriation"                        
## [542] "servr"                            
## [543] "setRNG"                           
## [544] "sfsmisc"                          
## [545] "sgeostat"                         
## [546] "shiny"                            
## [547] "shinyBS"                          
## [548] "shinydashboard"                   
## [549] "shinyIncubator"                   
## [550] "shinyjs"                          
## [551] "shinysense"                       
## [552] "shinythemes"                      
## [553] "ShortRead"                        
## [554] "siggenes"                         
## [555] "SKAT"                             
## [556] "slam"                             
## [557] "slidify"                          
## [558] "slidifyLibraries"                 
## [559] "smoother"                         
## [560] "snakecase"                        
## [561] "snow"                             
## [562] "SnowballC"                        
## [563] "sourcetools"                      
## [564] "sp"                               
## [565] "spam"                             
## [566] "sparklyr"                         
## [567] "SparseM"                          
## [568] "sROC"                             
## [569] "ssize"                            
## [570] "ssize.fdr"                        
## [571] "ssizeRNA"                         
## [572] "stargazer"                        
## [573] "statmod"                          
## [574] "stepPlr"                          
## [575] "stringi"                          
## [576] "stringr"                          
## [577] "styler"                           
## [578] "SummarizedExperiment"             
## [579] "SuperLearner"                     
## [580] "survey"                           
## [581] "survminer"                        
## [582] "survMisc"                         
## [583] "survSNP"                          
## [584] "sva"                              
## [585] "svd"                              
## [586] "SVGAnnotation"                    
## [587] "svglite"                          
## [588] "tableone"                         
## [589] "taxizedb"                         
## [590] "TeachingDemos"                    
## [591] "testthat"                         
## [592] "texreg"                           
## [593] "TH.data"                          
## [594] "tibble"                           
## [595] "tidyr"                            
## [596] "tidyselect"                       
## [597] "tidyshiny"                        
## [598] "tidytext"                         
## [599] "tidyverse"                        
## [600] "timeDate"                         
## [601] "tokenizers"                       
## [602] "topGO"                            
## [603] "translations"                     
## [604] "triebeard"                        
## [605] "trimcluster"                      
## [606] "TSP"                              
## [607] "TTR"                              
## [608] "twitteR"                          
## [609] "TxDb.Hsapiens.UCSC.hg19.knownGene"
## [610] "tximport"                         
## [611] "urltools"                         
## [612] "usethis"                          
## [613] "utf8"                             
## [614] "uuid"                             
## [615] "VariantAnnotation"                
## [616] "vcd"                              
## [617] "vdiffr"                           
## [618] "vegan"                            
## [619] "Vennerable"                       
## [620] "VGAM"                             
## [621] "VIM"                              
## [622] "vipor"                            
## [623] "viridis"                          
## [624] "viridisLite"                      
## [625] "visdat"                           
## [626] "visNetwork"                       
## [627] "vsn"                              
## [628] "WDI"                              
## [629] "webshot"                          
## [630] "whisker"                          
## [631] "withr"                            
## [632] "writexl"                          
## [633] "xlsx"                             
## [634] "xlsxjars"                         
## [635] "XML"                              
## [636] "xml2"                             
## [637] "xtable"                           
## [638] "xts"                              
## [639] "XVector"                          
## [640] "yaml"                             
## [641] "zebrafishRNASeq"                  
## [642] "Zelig"                            
## [643] "zip"                              
## [644] "zlibbioc"                         
## [645] "zoo"
## study package naming style (all lower case, contains '.', etc

## use `fields` argument to installed.packages() to get more info and use it!
ipt2 <- installed.packages(fields = "URL") %>%
  as_tibble()
ipt2 %>%
  mutate(github = grepl("github", URL)) %>%
  count(github) %>%
  mutate(prop = n / sum(n))
## # A tibble: 2 x 3
##   github     n  prop
##   <lgl>  <int> <dbl>
## 1 F        432 0.642
## 2 T        241 0.358

test124