패키지(Packages)
R의 패키지(Packages)
- 통계 분석을 위해 프로그래밍 언어로 개발된 R은 통계 프로그래밍을 위한 핵심 기능이 주로 구현되어 있습니다. 하지만 R을 활용하는 분야는 다양해서 R의 기본 함수로 부족한 경우도 많습니다.
- R의 패키지는 특정 분야에서 필요한 기능을 구현하여 모아 놓은 것이라고 할 수 있습니다. R이 기본 게임팩이라면 패키지는 일종의 _확장팩_입니다. R에는 이런 _확장팩_이 매우 많으며, 누구라도 자신 또는 다른 사람이 필요한 기능을 구현하여 패키지로 만들 수 있습니다.
- CRAN(The Comprehensive R Archive Network)는 많은 사람들이 필요로 하고 성능이 어느 정도 검증된 패키지를 모아 놓은 곳입니다.
패키지 설치
- 패키지를 설치하기 위해서는
install.packages()
를 쓴다.install.packages()
에서 packages에 유의하자. 그리고 패키지 이름은 따옴표로 감싼다. 여러 개의 패키지를 한꺼번에 설치하고 싶을 때에는install.packages(c('psych', 'MASS'))
와 같이 쓴다.
- R Studio의 메뉴에서 Tools > Install Packages를 선택할 수도 있다.
install.packages()
는 CRAN(The Comprehensive R Archive Network)에 정식으로 등록된 패키지를 설치할 수 있다. CRAN Task View(https://cran.r-project.org/web/views/)에서 특정 분야의 패키지 목록과 기능을 확인할 수 있다.- 패키지가 저장되어 있는 인터넷 주소를 저장소(repository)라고 한다. 그리고 저장소의 내용을 그대로 복사해 놓은 곳은 미러(mirror)라고 한다. 이 둘은 다음의 함수로 설정할 수 있다.
setRepositories()
chooseCRANmirror()
- 저장소 목록은 https://cran.r-project.org/mirrors.html에서 확인할 수 있으며 한국의 저장소 미러 목록은 다음과 같다.
| 주소 | 운영자 |
|:—————————|:————————————————–|
|https://ftp.harukasan.org/CRAN/
|Information and Database Systems Laboratory, Pukyong National University|
|https://cran.yu.ac.kr/
|Yeungnam University|
|https://cran.seoul.go.kr/
|Bigdata Campus, Seoul Metropolitan Govermment|
|http://healthstat.snu.ac.kr/CRAN/
|Graduate School of Public Health, Seoul National University, Seoul|
|https://cran.biodisk.org/
| The Genome Institute of UNIST (Ulsan National Institute of Science and Technology)|
|http://cran.biodisk.org/
|The Genome Institute of UNIST (Ulsan National Institute of Science and Technology)|
- 현재 설정되어 있는 저장소와 미러는
options('repos')
를 통해 확인할 수 있다. 만약 패키지 설치와 갱신과 관련하여 문제가 있다면 저장소와 미러 설정을 변경해 보는 것이 좋다.
options(repos='http://healthstat.snu.ac.kr/CRAN/')
install.packages("psych")
## Installing package into 'C:/Users/Seul/Documents/R/win-library/3.5' ## (as 'lib' is unspecified)
## package 'psych' successfully unpacked and MD5 sums checked ## ## The downloaded binary packages are in ## C:\Users\Seul\AppData\Local\Temp\RtmpKmsrz9\downloaded_packages
패키지 관련 정보
maintainer()
와citation()
을 통해 패키지를 관리하는 사람과 패키지를 인용하는 방법을 확인할 수 있다.
maintainer("psych")
## [1] "William Revelle <revelle@northwestern.edu>"
citation("psych")
## ## To cite the psych package in publications use: ## ## Revelle, W. (2018) psych: Procedures for Personality and ## Psychological Research, Northwestern University, Evanston, ## Illinois, USA, https://CRAN.R-project.org/package=psych Version ## = 1.8.12. ## ## A BibTeX entry for LaTeX users is ## ## @Manual{, ## title = {psych: Procedures for Psychological, Psychometric, and Personality Research}, ## author = {William Revelle}, ## organization = { Northwestern University}, ## address = { Evanston, Illinois}, ## year = {2018}, ## note = {R package version 1.8.12}, ## url = {https://CRAN.R-project.org/package=psych}, ## }
패키지 불러오기/확인하기/제거하기
- 패키지를 사용하기 위해서는 설치된 패키지를 메모리에 불러와야 한다(
library()
). 만약 더 이상 패키지를 사용할 필요가 없어졌다면detach()
를 통해 메모리에서 제거할 수도 있다. - 메모리에 올라온 패키지를 확인하기 위해서는
search()
함수를 사용한다.
library(psych)
describe(mtcars)
## vars n mean sd median trimmed mad min max range skew ## mpg 1 32 20.09 6.03 19.20 19.70 5.41 10.40 33.90 23.50 0.61 ## cyl 2 32 6.19 1.79 6.00 6.23 2.97 4.00 8.00 4.00 -0.17 ## disp 3 32 230.72 123.94 196.30 222.52 140.48 71.10 472.00 400.90 0.38 ## hp 4 32 146.69 68.56 123.00 141.19 77.10 52.00 335.00 283.00 0.73 ## drat 5 32 3.60 0.53 3.70 3.58 0.70 2.76 4.93 2.17 0.27 ## wt 6 32 3.22 0.98 3.33 3.15 0.77 1.51 5.42 3.91 0.42 ## qsec 7 32 17.85 1.79 17.71 17.83 1.42 14.50 22.90 8.40 0.37 ## vs 8 32 0.44 0.50 0.00 0.42 0.00 0.00 1.00 1.00 0.24 ## am 9 32 0.41 0.50 0.00 0.38 0.00 0.00 1.00 1.00 0.36 ## gear 10 32 3.69 0.74 4.00 3.62 1.48 3.00 5.00 2.00 0.53 ## carb 11 32 2.81 1.62 2.00 2.65 1.48 1.00 8.00 7.00 1.05 ## kurtosis se ## mpg -0.37 1.07 ## cyl -1.76 0.32 ## disp -1.21 21.91 ## hp -0.14 12.12 ## drat -0.71 0.09 ## wt -0.02 0.17 ## qsec 0.34 0.32 ## vs -2.00 0.09 ## am -1.92 0.09 ## gear -1.07 0.13 ## carb 1.26 0.29
search()
## [1] ".GlobalEnv" "package:psych" "package:bindrcpp" ## [4] "package:magrittr" "package:car" "package:carData" ## [7] "package:XMLRPC" "package:knitr" "package:RWordPress" ## [10] "package:dplyr" "package:data.table" "package:stringr" ## [13] "tools:rstudio" "package:stats" "package:graphics" ## [16] "package:grDevices" "package:utils" "package:datasets" ## [19] "package:methods" "Autoloads" "package:base"
detach("package:psych")
describe(mtcars)
## Error in describe(mtcars): could not find function "describe"
search()
## [1] ".GlobalEnv" "package:bindrcpp" "package:magrittr" ## [4] "package:car" "package:carData" "package:XMLRPC" ## [7] "package:knitr" "package:RWordPress" "package:dplyr" ## [10] "package:data.table" "package:stringr" "tools:rstudio" ## [13] "package:stats" "package:graphics" "package:grDevices" ## [16] "package:utils" "package:datasets" "package:methods" ## [19] "Autoloads" "package:base"
패키지 관리하기
- 설치된 패키지 목록을 확인하고 싶다면
installed.packages()
를 쓸 수 있다. - 패키지를 갱신(update)하고 싶다면
update.packages()
를 쓸 수 있다. - 다음 코드는
library()
,detach()
의 결과를search()
를 통해 확인하고 있다.
options(repos='http://healthstat.snu.ac.kr/CRAN/')
installed.packages()
## Package LibPath ## abind "abind" "C:/Users/Seul/Documents/R/win-library/3.5" ## acepack "acepack" "C:/Users/Seul/Documents/R/win-library/3.5" ## AER "AER" "C:/Users/Seul/Documents/R/win-library/3.5" ## askpass "askpass" "C:/Users/Seul/Documents/R/win-library/3.5" ## assertthat "assertthat" "C:/Users/Seul/Documents/R/win-library/3.5" ## backports "backports" "C:/Users/Seul/Documents/R/win-library/3.5" ## base64enc "base64enc" "C:/Users/Seul/Documents/R/win-library/3.5" ## BH "BH" "C:/Users/Seul/Documents/R/win-library/3.5" ## bindr "bindr" "C:/Users/Seul/Documents/R/win-library/3.5" ## bindrcpp "bindrcpp" "C:/Users/Seul/Documents/R/win-library/3.5" ## binman "binman" "C:/Users/Seul/Documents/R/win-library/3.5" ## bit "bit" "C:/Users/Seul/Documents/R/win-library/3.5" ## bit64 "bit64" "C:/Users/Seul/Documents/R/win-library/3.5" ## bitops "bitops" "C:/Users/Seul/Documents/R/win-library/3.5" ## blob "blob" "C:/Users/Seul/Documents/R/win-library/3.5" ## bookdown "bookdown" "C:/Users/Seul/Documents/R/win-library/3.5" ## callr "callr" "C:/Users/Seul/Documents/R/win-library/3.5" ## car "car" "C:/Users/Seul/Documents/R/win-library/3.5" ## carData "carData" "C:/Users/Seul/Documents/R/win-library/3.5" ## caTools "caTools" "C:/Users/Seul/Documents/R/win-library/3.5" ## cellranger "cellranger" "C:/Users/Seul/Documents/R/win-library/3.5" ## checkmate "checkmate" "C:/Users/Seul/Documents/R/win-library/3.5" ## cli "cli" "C:/Users/Seul/Documents/R/win-library/3.5" ## clipr "clipr" "C:/Users/Seul/Documents/R/win-library/3.5" ## clisymbols "clisymbols" "C:/Users/Seul/Documents/R/win-library/3.5" ## colorspace "colorspace" "C:/Users/Seul/Documents/R/win-library/3.5" ## cowplot "cowplot" "C:/Users/Seul/Documents/R/win-library/3.5" ## crayon "crayon" "C:/Users/Seul/Documents/R/win-library/3.5" ## crosstalk "crosstalk" "C:/Users/Seul/Documents/R/win-library/3.5" ## curl "curl" "C:/Users/Seul/Documents/R/win-library/3.5" ## data.table "data.table" "C:/Users/Seul/Documents/R/win-library/3.5" ## DBI "DBI" "C:/Users/Seul/Documents/R/win-library/3.5" ## desc "desc" "C:/Users/Seul/Documents/R/win-library/3.5" ## devtools "devtools" "C:/Users/Seul/Documents/R/win-library/3.5" ## digest "digest" "C:/Users/Seul/Documents/R/win-library/3.5" ## dplyr "dplyr" "C:/Users/Seul/Documents/R/win-library/3.5" ## evaluate "evaluate" "C:/Users/Seul/Documents/R/win-library/3.5" ## fansi "fansi" "C:/Users/Seul/Documents/R/win-library/3.5" ## farver "farver" "C:/Users/Seul/Documents/R/win-library/3.5" ## forcats "forcats" "C:/Users/Seul/Documents/R/win-library/3.5" ## formatR "formatR" "C:/Users/Seul/Documents/R/win-library/3.5" ## Formula "Formula" "C:/Users/Seul/Documents/R/win-library/3.5" ## fs "fs" "C:/Users/Seul/Documents/R/win-library/3.5" ## gapminder "gapminder" "C:/Users/Seul/Documents/R/win-library/3.5" ## geosphere "geosphere" "C:/Users/Seul/Documents/R/win-library/3.5" ## gganimate "gganimate" "C:/Users/Seul/Documents/R/win-library/3.5" ## ggmap "ggmap" "C:/Users/Seul/Documents/R/win-library/3.5" ## ggplot2 "ggplot2" "C:/Users/Seul/Documents/R/win-library/3.5" ## gh "gh" "C:/Users/Seul/Documents/R/win-library/3.5" ## gifski "gifski" "C:/Users/Seul/Documents/R/win-library/3.5" ## git2r "git2r" "C:/Users/Seul/Documents/R/win-library/3.5" ## glue "glue" "C:/Users/Seul/Documents/R/win-library/3.5" ## gridExtra "gridExtra" "C:/Users/Seul/Documents/R/win-library/3.5" ## gsubfn "gsubfn" "C:/Users/Seul/Documents/R/win-library/3.5" ## gtable "gtable" "C:/Users/Seul/Documents/R/win-library/3.5" ## hash "hash" "C:/Users/Seul/Documents/R/win-library/3.5" ## haven "haven" "C:/Users/Seul/Documents/R/win-library/3.5" ## hexbin "hexbin" "C:/Users/Seul/Documents/R/win-library/3.5" ## highr "highr" "C:/Users/Seul/Documents/R/win-library/3.5" ## Hmisc "Hmisc" "C:/Users/Seul/Documents/R/win-library/3.5" ## hms "hms" "C:/Users/Seul/Documents/R/win-library/3.5" ## htmltab "htmltab" "C:/Users/Seul/Documents/R/win-library/3.5" ## Version Priority ## abind "1.4-5" NA ## acepack "1.4.1" NA ## AER "1.2-6" NA ## askpass "1.1" NA ## assertthat "0.2.0" NA ## backports "1.1.3" NA ## base64enc "0.1-3" NA ## BH "1.69.0-1" NA ## bindr "0.1.1" NA ## bindrcpp "0.2.2" NA ## binman "0.1.1" NA ## bit "1.1-14" NA ## bit64 "0.9-7" NA ## bitops "1.0-6" NA ## blob "1.1.1" NA ## bookdown "0.9" NA ## callr "3.1.1" NA ## car "3.0-2" NA ## carData "3.0-2" NA ## caTools "1.17.1.1" NA ## cellranger "1.1.0" NA ## checkmate "1.9.1" NA ## cli "1.0.1" NA ## clipr "0.5.0" NA ## clisymbols "1.2.0" NA ## colorspace "1.4-0" NA ## cowplot "0.9.4" NA ## crayon "1.3.4" NA ## crosstalk "1.0.0" NA ## curl "3.3" NA ## data.table "1.12.0" NA ## DBI "1.0.0" NA ## desc "1.2.0" NA ## devtools "2.0.1" NA ## digest "0.6.18" NA ## dplyr "0.7.8" NA ## evaluate "0.12" NA ## fansi "0.4.0" NA ## farver "1.1.0" NA ## forcats "0.3.0" NA ## formatR "1.5" NA ## Formula "1.2-3" NA ## fs "1.2.6" NA ## gapminder "0.3.0" NA ## geosphere "1.5-7" NA ## gganimate "1.0.0" NA ## ggmap "2.6.2" NA ## ggplot2 "3.1.0" NA ## gh "1.0.1" NA ## gifski "0.8.6" NA ## git2r "0.24.0" NA ## glue "1.3.0" NA ## gridExtra "2.3" NA ## gsubfn "0.7" NA ## gtable "0.2.0" NA ## hash "2.2.6" NA ## haven "2.0.0" NA ## hexbin "1.27.2" NA ## highr "0.7" NA ## Hmisc "4.2-0" NA ## hms "0.4.2" NA ## htmltab "0.7.1" NA ## Depends ## abind "R (>= 1.5.0)" ## acepack NA ## AER "R (>= 2.13.0), car (>= 2.0-19), lmtest, sandwich (>= 2.4-0),\nsurvival (>= 2.37-5), zoo" ## askpass NA ## assertthat NA ## backports "R (>= 3.0.0)" ## base64enc "R (>= 2.9.0)" ## BH NA ## bindr NA ## bindrcpp NA ## binman "R (>= 3.3)" ## bit "R (>= 2.9.2)" ## bit64 "R (>= 3.0.1), bit (>= 1.1-12), utils, methods, stats" ## bitops NA ## blob NA ## bookdown NA ## callr NA ## car "R (>= 3.2.0), carData (>= 3.0-0)" ## carData "R (>= 3.0)" ## caTools "R (>= 2.2.0)" ## cellranger "R (>= 3.0.0)" ## checkmate "R (>= 3.0.0)" ## cli "R (>= 2.10)" ## clipr NA ## clisymbols NA ## colorspace "R (>= 3.0.0), methods" ## cowplot "R (>= 3.3.0), ggplot2 (>= 2.1.0)," ## crayon NA ## crosstalk NA ## curl "R (>= 3.0.0)" ## data.table "R (>= 3.1.0)" ## DBI "R (>= 3.0.0), methods" ## desc "R (>= 3.1.0)" ## devtools "R (>= 3.0.2)" ## digest "R (>= 3.1.0)" ## dplyr "R (>= 3.1.2)" ## evaluate "R (>= 3.0.2)" ## fansi "R (>= 3.1.0)" ## farver NA ## forcats "R (>= 3.1)" ## formatR "R (>= 3.0.2)" ## Formula "R (>= 2.0.0), stats" ## fs "R (>= 3.1)" ## gapminder "R (>= 3.1.0)" ## geosphere "R (>= 3.0.0)" ## gganimate "ggplot2 (>= 3.0.0)" ## ggmap "R (>= 2.14.0), ggplot2 (>= 2.0.0)" ## ggplot2 "R (>= 3.1)" ## gh NA ## gifski NA ## git2r "R (>= 3.1)" ## glue "R (>= 3.1)" ## gridExtra NA ## gsubfn "proto" ## gtable "R (>= 2.14)" ## hash "R (>= 2.12.0), methods, utils" ## haven "R (>= 3.1)" ## hexbin "R (>= 2.0.1), methods" ## highr "R (>= 3.0.2)" ## Hmisc "lattice, survival (>= 2.40-1), Formula, ggplot2 (>= 2.2)" ## hms NA ## htmltab "R (>= 3.0.0)" ## Imports ## abind "methods, utils" ## acepack NA ## AER "stats, Formula (>= 0.2-0)" ## askpass "sys (>= 2.1)" ## assertthat "tools" ## backports "utils" ## base64enc NA ## BH NA ## bindr NA ## bindrcpp "bindr (>= 0.1.1), Rcpp (>= 0.12.16)" ## binman "rappdirs, yaml, httr, jsonlite, xml2, utils, stats,\nassertthat, semver" ## bit NA ## bit64 NA ## bitops NA ## blob "methods, prettyunits" ## bookdown "htmltools (>= 0.3.6), knitr (>= 1.16), rmarkdown (>= 1.9),\nxfun (>= 0.2), tinytex, yaml (>= 2.1.14)" ## callr "processx (>= 3.2.1), R6, utils" ## car "abind, MASS, mgcv, nnet, pbkrtest (>= 0.4-4), quantreg,\ngrDevices, utils, stats, graphics, maptools, rio, lme4, nlme" ## carData NA ## caTools "bitops" ## cellranger "rematch, tibble" ## checkmate "backports (>= 1.1.0), utils" ## cli "assertthat, crayon (>= 1.3.4), methods, utils" ## clipr "utils" ## clisymbols NA ## colorspace "graphics, grDevices, stats" ## cowplot "grid (>= 3.0.0), gtable (>= 0.1.2), plyr (>= 1.8.2),\ngrDevices, methods, scales, utils" ## crayon "grDevices, methods, utils" ## crosstalk "htmltools (>= 0.3.5), jsonlite, lazyeval, R6, shiny (>= 0.11),\nggplot2" ## curl NA ## data.table "methods" ## DBI NA ## desc "assertthat, utils, R6, crayon, rprojroot" ## devtools "callr, cli, digest, git2r (>= 0.23.0), httr (>= 0.4),\njsonlite, memoise (>= 1.0.0), pkgbuild (>= 1.0.2), pkgload (>=\n1.0.1), rcmdcheck (>= 1.3.0), remotes (>= 2.0.0), rstudioapi\n(>= 0.6.0.9000), sessioninfo, stats, tools, usethis (>= 1.4.0),\nutils, withr" ## digest NA ## dplyr "assertthat (>= 0.2.0), bindrcpp (>= 0.2.0.9000), glue (>=\n1.1.1), magrittr (>= 1.5), methods, pkgconfig (>= 2.0.1), R6\n(>= 2.2.2), Rcpp (>= 0.12.19), rlang (>= 0.3.0), tibble (>=\n1.4.2), tidyselect (>= 0.2.3), utils" ## evaluate "methods" ## fansi NA ## farver "Rcpp (>= 0.12.15)" ## forcats "magrittr, rlang, tibble" ## formatR NA ## Formula NA ## fs "methods, Rcpp" ## gapminder "tibble" ## geosphere "sp" ## gganimate "stringi, tweenr (>= 1.0.1), grid, rlang, glue, progress, plyr,\nscales, grDevices, utils" ## ggmap "proto, RgoogleMaps, png, plyr, reshape2, rjson, mapproj, jpeg,\ngeosphere, digest, scales" ## ggplot2 "digest, grid, gtable (>= 0.1.1), lazyeval, MASS, mgcv, plyr\n(>= 1.7.1), reshape2, rlang (>= 0.2.1), scales (>= 0.5.0),\nstats, tibble, viridisLite, withr (>= 2.0.0)" ## gh "ini, jsonlite, httr" ## gifski NA ## git2r "graphics, utils" ## glue "methods" ## gridExtra "gtable, grid, grDevices, graphics, utils" ## gsubfn NA ## gtable "grid" ## hash NA ## haven "forcats (>= 0.2.0), hms, Rcpp (>= 0.11.4), readr (>= 0.1.0),\ntibble" ## hexbin "lattice, grid, graphics, grDevices, stats, utils" ## highr NA ## Hmisc "methods, latticeExtra, cluster, rpart, nnet, acepack, foreign,\ngtable, grid, gridExtra, data.table, htmlTable (>= 1.11.0),\nviridis, htmltools, base64enc" ## hms "methods, pkgconfig, rlang" ## htmltab "XML (>= 3.98.1.3), httr (>= 1.0.0)" ## LinkingTo ## abind NA ## acepack NA ## AER NA ## askpass NA ## assertthat NA ## backports NA ## base64enc NA ## BH NA ## bindr NA ## bindrcpp "plogr, Rcpp" ## binman NA ## bit NA ## bit64 NA ## bitops NA ## blob NA ## bookdown NA ## callr NA ## car NA ## carData NA ## caTools NA ## cellranger NA ## checkmate NA ## cli NA ## clipr NA ## clisymbols NA ## colorspace NA ## cowplot NA ## crayon NA ## crosstalk NA ## curl NA ## data.table NA ## DBI NA ## desc NA ## devtools NA ## digest NA ## dplyr "BH (>= 1.58.0-1), bindrcpp (>= 0.2.0.9000), plogr (>=\n0.1.10), Rcpp (>= 0.12.15)" ## evaluate NA ## fansi NA ## farver "Rcpp" ## forcats NA ## formatR NA ## Formula NA ## fs "Rcpp" ## gapminder NA ## geosphere NA ## gganimate NA ## ggmap NA ## ggplot2 NA ## gh NA ## gifski NA ## git2r NA ## glue NA ## gridExtra NA ## gsubfn NA ## gtable NA ## hash NA ## haven "Rcpp" ## hexbin NA ## highr NA ## Hmisc NA ## hms NA ## htmltab NA ## Suggests ## abind NA ## acepack "testthat" ## AER "boot, dynlm, effects, fGarch, forecast, foreign, ineq,\nKernSmooth, lattice, longmemo, MASS, mlogit, nlme, nnet, np,\nplm, pscl, quantreg, rgl, ROCR, rugarch, sampleSelection,\nscatterplot3d, strucchange, systemfit (>= 1.1-20), truncreg,\ntseries, urca, vars" ## askpass "testthat" ## assertthat "testthat" ## backports NA ## base64enc NA ## BH NA ## bindr "testthat" ## bindrcpp "testthat" ## binman "testthat, covr, knitr, rmarkdown" ## bit NA ## bit64 NA ## bitops NA ## blob "covr, pillar (>= 1.2.1), testthat" ## bookdown "htmlwidgets, rstudioapi, miniUI, rsconnect (>= 0.4.3), servr\n(>= 0.3), shiny, testit (>= 0.5), tufte, webshot" ## callr "cliapp, covr, crayon, pingr, ps, testthat, withr" ## car "alr4, boot, coxme, leaps, lmtest, Matrix, MatrixModels, rgl\n(>= 0.93.960), sandwich, SparseM, survival, survey" ## carData NA ## caTools "MASS, rpart" ## cellranger "covr, testthat (>= 1.0.0), knitr, rmarkdown" ## checkmate "R6, bit, fastmatch, data.table (>= 1.9.8), devtools, ggplot2,\nknitr, magrittr, microbenchmark, rmarkdown, testthat (>=\n0.11.0), tibble" ## cli "covr, fansi, mockery, testthat, webshot, withr" ## clipr "covr, rstudioapi (>= 0.5), testthat (>= 2.0.0)" ## clisymbols "testthat" ## colorspace "datasets, utils, KernSmooth, MASS, kernlab, mvtnorm, vcd,\ntcltk, shiny, shinyjs, ggplot2, dplyr, scales, grid, png, jpeg,\nknitr, rmarkdown, RColorBrewer, rcartocolor, scico, viridis" ## cowplot "covr, gridGraphics, knitr, rmarkdown, magick, maps, dplyr,\ntidyr, testthat, vdiffr, viridis" ## crayon "mockery, rstudioapi, testthat, withr" ## crosstalk NA ## curl "spelling, testthat (>= 1.0.0), knitr, jsonlite, rmarkdown,\nmagrittr, httpuv (>= 1.4.4), webutils" ## data.table "bit64, curl, R.utils, knitr, xts, nanotime, zoo" ## DBI "blob, covr, hms, knitr, magrittr, rprojroot, rmarkdown,\nRSQLite (>= 1.1-2), testthat, xml2" ## desc "covr, testthat, whoami, withr" ## devtools "BiocInstaller, BiocManager, bitops, covr (>= 3.2.0), crayon,\ncurl (>= 0.9), evaluate, foghorn (>= 1.0.1), gmailr (> 0.7.0),\nknitr, lintr (>= 0.2.1), mockery, pingr, MASS, pkgdown, Rcpp\n(>= 0.10.0), rhub, rmarkdown, roxygen2 (>= 6.1.0), rversions,\nspelling (>= 1.1), testthat (>= 1.0.2), whisker" ## digest "knitr, rmarkdown" ## dplyr "bit64 (>= 0.9.7), callr, covr (>= 3.0.1), DBI (>= 0.7.14),\ndbplyr (>= 1.2.0), dtplyr (>= 0.0.2), ggplot2 (>= 2.2.1), hms\n(>= 0.4.1), knitr (>= 1.19), Lahman (>= 3.0-1), lubridate,\nMASS, mgcv (>= 1.8.23), microbenchmark (>= 1.4.4), nycflights13\n(>= 0.2.2), rmarkdown (>= 1.8), RMySQL (>= 0.10.13),\nRPostgreSQL (>= 0.6.2), RSQLite (>= 2.0), testthat (>= 2.0.0),\nwithr (>= 2.1.1)" ## evaluate "testthat, lattice, ggplot2" ## fansi "unitizer, knitr, rmarkdown" ## farver "testthat, covr" ## forcats "covr, ggplot2, testthat" ## formatR "codetools, shiny, testit, rmarkdown, knitr" ## Formula NA ## fs "testthat, covr, pillar (>= 1.0.0), crayon, withr" ## gapminder "dplyr, ggplot2, testthat" ## geosphere "methods, raster" ## gganimate "magick, svglite, knitr, rmarkdown, testthat, base64enc,\nhtmltools, covr, transformr, av, png, gifski" ## ggmap "MASS, stringr, hexbin, dplyr" ## ggplot2 "covr, dplyr, ggplot2movies, hexbin, Hmisc, lattice, mapproj,\nmaps, maptools, multcomp, munsell, nlme, testthat (>= 0.11.0),\nvdiffr, quantreg, knitr, rgeos, rpart, rmarkdown, sf (>=\n0.3-4), svglite (>= 1.2.0.9001)" ## gh "covr, pingr, testthat" ## gifski "ggplot2, gapminder" ## git2r "getPass" ## glue "testthat, covr, magrittr, crayon, knitr, rmarkdown, DBI,\nRSQLite, R.utils, forcats, microbenchmark, rprintf, stringr,\nggplot2, dplyr, withr" ## gridExtra "ggplot2, egg, lattice, knitr, testthat" ## gsubfn "boot, chron, grid, lattice, quantreg, svUnit, tcltk, zoo" ## gtable "testthat, covr" ## hash "testthat" ## haven "covr, fs, knitr, rmarkdown, testthat" ## hexbin "marray, affy, Biobase, limma" ## highr "knitr, testit" ## Hmisc "chron, rms, mice, tables, knitr, ff, ffbase, plotly (>=\n4.5.6), rlang" ## hms "crayon, lubridate, pillar (>= 1.1.0), testthat" ## htmltab "testthat, knitr, tidyr" ## Enhances ## abind NA ## acepack NA ## AER NA ## askpass NA ## assertthat NA ## backports NA ## base64enc "png" ## BH NA ## bindr NA ## bindrcpp NA ## binman NA ## bit NA ## bit64 NA ## bitops NA ## blob NA ## bookdown NA ## callr NA ## car NA ## carData NA ## caTools NA ## cellranger NA ## checkmate NA ## cli NA ## clipr NA ## clisymbols NA ## colorspace NA ## cowplot NA ## crayon NA ## crosstalk NA ## curl NA ## data.table NA ## DBI NA ## desc NA ## devtools NA ## digest NA ## dplyr NA ## evaluate NA ## fansi NA ## farver NA ## forcats NA ## formatR NA ## Formula NA ## fs NA ## gapminder NA ## geosphere NA ## gganimate NA ## ggmap NA ## ggplot2 "sp" ## gh NA ## gifski NA ## git2r NA ## glue NA ## gridExtra NA ## gsubfn NA ## gtable NA ## hash NA ## haven NA ## hexbin NA ## highr NA ## Hmisc NA ## hms NA ## htmltab NA ## License License_is_FOSS ## abind "LGPL (>= 2)" NA ## acepack "MIT + file LICENSE" NA ## AER "GPL-2 | GPL-3" NA ## askpass "MIT + file LICENSE" NA ## assertthat "GPL-3" NA ## backports "GPL-2" NA ## base64enc "GPL-2 | GPL-3" NA ## BH "BSL-1.0" NA ## bindr "MIT + file LICENSE" NA ## bindrcpp "MIT + file LICENSE" NA ## binman "MIT + file LICENSE" NA ## bit "GPL-2" NA ## bit64 "GPL-2" NA ## bitops "GPL (>= 2)" NA ## blob "GPL-3" NA ## bookdown "GPL-3" NA ## callr "MIT + file LICENSE" NA ## car "GPL (>= 2)" NA ## carData "GPL (>= 2)" NA ## caTools "GPL-3" NA ## cellranger "MIT + file LICENSE" NA ## checkmate "BSD_3_clause + file LICENSE" NA ## cli "MIT + file LICENSE" NA ## clipr "GPL-3" NA ## clisymbols "MIT + file LICENSE" NA ## colorspace "BSD_3_clause + file LICENSE" NA ## cowplot "GPL-2" NA ## crayon "MIT + file LICENSE" NA ## crosstalk "MIT + file LICENSE" NA ## curl "MIT + file LICENSE" NA ## data.table "MPL-2.0 | file LICENSE" NA ## DBI "LGPL (>= 2)" NA ## desc "MIT + file LICENSE" NA ## devtools "GPL (>= 2)" NA ## digest "GPL (>= 2)" NA ## dplyr "MIT + file LICENSE" NA ## evaluate "MIT + file LICENSE" NA ## fansi "GPL (>= 2)" NA ## farver "MIT + file LICENSE" NA ## forcats "GPL-3" NA ## formatR "GPL" NA ## Formula "GPL-2 | GPL-3" NA ## fs "GPL-3" NA ## gapminder "CC0" NA ## geosphere "GPL (>= 3)" NA ## gganimate "MIT + file LICENSE" NA ## ggmap "GPL-2" NA ## ggplot2 "GPL-2 | file LICENSE" NA ## gh "MIT + file LICENSE" NA ## gifski "MIT + file LICENSE" NA ## git2r "GPL-2" NA ## glue "MIT + file LICENSE" NA ## gridExtra "GPL (>= 2)" NA ## gsubfn "GPL (>= 2)" NA ## gtable "GPL-2" NA ## hash "GPL (>= 2)" NA ## haven "MIT + file LICENSE" NA ## hexbin "GPL-2" NA ## highr "GPL" NA ## Hmisc "GPL (>= 2)" NA ## hms "GPL-3" NA ## htmltab "MIT + file LICENSE" NA ## License_restricts_use OS_type MD5sum NeedsCompilation Built ## abind NA NA NA "no" "3.5.2" ## acepack NA NA NA "yes" "3.5.2" ## AER NA NA NA "no" "3.5.2" ## askpass NA NA NA "yes" "3.5.2" ## assertthat NA NA NA "no" "3.5.2" ## backports NA NA NA "yes" "3.5.2" ## base64enc NA NA NA "yes" "3.5.2" ## BH NA NA NA "no" "3.5.2" ## bindr NA NA NA "no" "3.5.2" ## bindrcpp NA NA NA "yes" "3.5.2" ## binman NA NA NA "no" "3.5.2" ## bit NA NA NA "yes" "3.5.2" ## bit64 NA NA NA "yes" "3.5.2" ## bitops NA NA NA "yes" "3.5.2" ## blob NA NA NA "no" "3.5.2" ## bookdown NA NA NA "no" "3.5.2" ## callr NA NA NA "no" "3.5.2" ## car NA NA NA "no" "3.5.2" ## carData NA NA NA "no" "3.5.2" ## caTools NA NA NA "yes" "3.5.2" ## cellranger NA NA NA "no" "3.5.2" ## checkmate NA NA NA "yes" "3.5.2" ## cli NA NA NA "no" "3.5.2" ## clipr NA NA NA "no" "3.5.2" ## clisymbols NA NA NA "no" "3.5.2" ## colorspace NA NA NA "yes" "3.5.2" ## cowplot NA NA NA "no" "3.5.2" ## crayon NA NA NA "no" "3.5.2" ## crosstalk NA NA NA "no" "3.5.2" ## curl NA NA NA "yes" "3.5.2" ## data.table NA NA NA "yes" "3.5.2" ## DBI NA NA NA "no" "3.5.2" ## desc NA NA NA "no" "3.5.2" ## devtools NA NA NA "no" "3.5.2" ## digest NA NA NA "yes" "3.5.2" ## dplyr NA NA NA "yes" "3.5.2" ## evaluate NA NA NA "no" "3.5.2" ## fansi NA NA NA "yes" "3.5.2" ## farver NA NA NA "yes" "3.5.2" ## forcats NA NA NA "no" "3.5.2" ## formatR NA NA NA "no" "3.5.2" ## Formula NA NA NA "no" "3.5.2" ## fs NA NA NA "yes" "3.5.2" ## gapminder NA NA NA "no" "3.5.2" ## geosphere NA NA NA "yes" "3.5.2" ## gganimate NA NA NA "no" "3.5.2" ## ggmap NA NA NA "no" "3.5.2" ## ggplot2 NA NA NA "no" "3.5.2" ## gh NA NA NA "no" "3.5.2" ## gifski NA NA NA "yes" "3.5.2" ## git2r NA NA NA "yes" "3.5.2" ## glue NA NA NA "yes" "3.5.2" ## gridExtra NA NA NA "no" "3.5.2" ## gsubfn NA NA NA "no" "3.5.2" ## gtable NA NA NA "no" "3.5.2" ## hash NA NA NA "no" "3.5.2" ## haven NA NA NA "yes" "3.5.2" ## hexbin NA NA NA "yes" "3.5.2" ## highr NA NA NA "no" "3.5.2" ## Hmisc NA NA NA "yes" "3.5.2" ## hms NA NA NA "no" "3.5.2" ## htmltab NA NA NA "no" "3.5.2" ## [ reached getOption("max.print") -- omitted 149 rows ]
update.packages("psych")
중복되는 함수와 변수
- 다음의 예를 보자.
package:psych
와package:car
에는 모두logit
이라는 이름을 가진 함수가 있다. 이 둘을library()
를 사용하여 모두 메모리에 불러들였을 때logit
은 어떤 패키지의logit
을 가리키게 될까?- 그냥
logit()
을 쓰면 가장 최근에 불러온 패키지의 함수가 실행된다. - 이 둘을 구분하려면 함수명 앞에 패키지 이름을 적고
::
로 패키지와 함수를 연결한다.
- 그냥
library(psych)
## ## Attaching package: 'psych'
## The following object is masked from 'package:car': ## ## logit
library(car) # car : Companion to Applied Regression
psych::logit(60)
## Warning in log(p/(1 - p)): NaNs produced
## [1] NaN
car::logit(60)
## [1] 0.4054651
logit(60)
## Warning in log(p/(1 - p)): NaNs produced
## [1] NaN
- Ref) Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition, Sage.
Leave a comment