ðæ¯æã®ç¿æ £ãšããŠRããã±ãŒãžã®ç£èŠãããŠããŸã
ã¿ã€ãã«ã«åœãããããããããã£ãŠãããããšãã話ã§ãã
Rã®æ©èœãæ¡åŒµãã䟿å©ãªããã±ãŒãžã¯Rãã®ãã®ãRã®ããã±ãŒãžã管çããCRANã«ç»é²ãããŠããŸããç§ã¯ãããã±ãŒãžã®èªã¿èŸŒã¿æã«ããã±ãŒãžãã€ã³ã¹ããŒã«ãããŠããªãããã«there is no package called
ãšæãããã®ãå«ã§ãRã®ã€ã³ã¹ããŒã«æã«CRANç»é²æžã¿ã®å
šããã±ãŒãžãã€ã³ã¹ããŒã«ãããã¿ãããªããšããã£ãŠããã®ã§ããããã以éã«è¿œå ç»é²ãããããã±ãŒãžã«ã€ããŠã¯ç¥ããªãããšãå€ããæéãçµã£ãã®ã§ããããã®ããã±ãŒãžãã€ã³ã¹ããŒã«ãããŠããªãç¶æ³ã«ãªã£ãŠããŸããã
CRANã«ç»é²ãããããã±ãŒãžã¯ãCRANã®ãŠã§ãããŒãžãã確èªã§ããŸãããŸããæŽæ°æ å ±ãèŠããããŸãšããŠãç¥ããããŠãããCRANberriesãæåã§ãã
CRANberriesã§ã¯feedãçºè¡ããŠããã®ã§ããã±ãŒãžã®æŽæ°ã»è¿œå ã®æ å ±ãåŸãããšãã§ããŸãããç§ã¯è³ŒèªããŠããŸããããã£ãããªã®ã§æ¬å®¶ã§ããCRANã®æ å ±ãå ã«ããŠãããã±ãŒãžã®æ å ±ãåŸãããšããã§ããçŸç¶ãšããŠãäœãããã®ããã±ãŒãžãæ¯æ¥æŽæ°ãããŠããŸãããªã®ã§1æ¥äžåè¿œå ãããRããã±ãŒãžã«ã€ããŠã®æ å ±ãååŸããã°è¯ãããã§ãããšããããã§ãŠã§ãã¹ã¯ã¬ã€ãã³ã°ã«ãã£ãŠè¿œå ç»é²ãããããã±ãŒãžãGmailã§éãããšããä»çµã¿ãæ§ç¯ããŸãã
ãŸãã¯çŸåšã€ã³ã¹ããŒã«ãããŠããããã±ãŒãžæ°ã確èªããŸãããã
# ã€ã³ã¹ããŒã«ãããŠããããã±ãŒãžåã®ããŒã¿ãã¬ãŒã installed_pkg <- installed.packages() %>% as.data.frame(stringsAsFactors = FALSE) %$% Package # ã€ã³ã¹ããŒã«æžã¿ã®ããã±ãŒãžæ° length(installed_pkg)
## [1] 5150
library(Hmisc) # %in% ã®åŠå®æŒç®å %nin% ãæå¹ã«ãããã library(rvest) library(gmailr) # RããGmailçµç±ã§ã¡ãŒã«ãéä¿¡ããããã±ãŒãž library(lubridate) library(dplyr)
æªã€ã³ã¹ããŒã«ã®CRANããã±ãŒãž
available.packages()
é¢æ°ã¯ãCRANã«ç»é²ãããRããã±ãŒãžã®äžèŠ§ãè¿ããŸãããã®äžèŠ§ãšã€ã³ã¹ããŒã«æžã¿ã®ããã±ãŒãžãæ¯èŒããŠãã©ã®ããã±ãŒãžãã€ã³ã¹ããŒã«ãããŠããªãã®ãã調ã¹ãŸãã
# CRANã«ç»é²ãããŠããããã±ãŒãžã®äžèŠ§ãããŒã¿ãã¬ãŒã ã«æ ŒçŽ df_all_pkg <- available.packages() %>% as.data.frame(stringsAsFactors = FALSE)
2015-12-27çŸåšãCRANã«ã¯7684ã®ããã±ãŒãžãç»é²ãããŠããŸãããã¯ãã€ã³ã¹ããŒã«ãããŠããæ°ãšçµæ§å·®ããããŸããã
ã€ã³ã¹ããŒã«æžã¿ã®ããã±ãŒãžã«å«ãŸããªããCRANã«ç»é²ãããŠããããã±ãŒãžã®ååã®ãã¯ãã«ãäœããŸãã
available_pkg <- df_all_pkg %>% dplyr::filter(Package %nin% installed_pkg) %$% Package
ããããäžæ¬ã§ã€ã³ã¹ããŒã«ããã«ã¯æ¬¡ã®ã³ãŒããå®è¡ããŸããããã§CRANã«ç»é²ãããŠããŠå©çšå¯èœãªæ°ãšã€ã³ã¹ããŒã«ãããŠããããã±ãŒãžæ°ã«å·®ããªããªããŸããã
install.packages(pkgs = available_pkg, dependencies = TRUE)
CRANã®ãºãŒãžãããŠã§ãã¹ã¯ã¬ã€ãã³ã°
ã§ã¯ä»¥éæ¯æ¥ã®æŽæ°ãç£èŠããŠè¿œå ãããããã±ãŒãžãéç¥ããããšããããšããããŸããããæ¥ä»ããšã«ãŸãšãŸã£ãŠãããºãŒãžãã¹ã¯ã¬ã€ãã³ã°ã®å¯Ÿè±¡ã«ããŸãã
# ç»é²æ¥ïŒæŽæ°å«ãïŒã®æ¥ä»é ã«é åãããããŒãã«ãããããã±ãŒãžæ å ±ãååŸ # .dplyr::filter()å ã§å®è¡æ¥ã®æ¥ä»ã ããæœåºïŒlubridate::today()ïŒ df_available_list <- read_html("https://cran.r-project.org/web/packages/available_packages_by_date.html") %>% html_node(., css = "table") %>% html_table() %>% dplyr::filter(Date == today(tzone = "UTC")) nrow(df_available_list)
## [1] 8
ãã®ãŸãŸã§ã¯ãã§ã«ã€ã³ã¹ããŒã«ãããŠãããæŽæ°ãããããã±ãŒãžãå«ãŸããŠããã®ã§ãå ã»ã©ãšåããã€ã³ã¹ããŒã«æžäžèŠ§ã«ãªããã®ã ãã«çµããŸãã
# ã€ã³ã¹ããŒã«ãããŠããªã"æ°èŠ"ã®ããã±ãŒãž df_new_pkg <- df_available_list %>% dplyr::filter(Package %nin% installed_pkg) nrow(df_new_pkg)
## [1] 5
Date | Package | Title |
---|---|---|
2015-12-26 | NNLM | Fast and Versatile Non-Negative Matrix Factorization |
2015-12-26 | oasis | Multiple Sclerosis Lesion Segmentation using Magnetic Resonance Imaging (MRI) |
2015-12-26 | ShapeSelectForest | Shape Selection for Landsat Time Series of Forest Dynamics |
2015-12-26 | TransferEntropy | The Transfer Entropy Package |
2015-12-26 | validateRS | One-Sided Multivariate Testing Procedures for Rating Systems |
ã€ã³ã¹ããŒã«æ¹æ³ãå ãšåãã§ãã
install.packages(pkgs = df_new_pkg$Package, dependencies = TRUE)
Gmailã§éç¥ãã
{gmailr}
ãšããããã±ãŒãžãå©çšããŠãRããGmailã§ã¡ãŒã«ãéããŸãïŒããã ãã§ãçŽ æŽãããïŒãå©çšæ¹æ³ã¯GitHubã®READMEãvignettesã«ããããŸããããã¡ãããã芪åãªæãã§ãã
è«žã ã®èšå®ãæžãŸããŠClient IDã®èšèŒãããjsonãã¡ã€ã«ãçšæããŸããbodyéšåããããããããã°æãããã§ãã
gmail_auth(secret_file = "<Client ID>.json", scope = "compose") mime(To = "<åä¿¡å ã®ã¡ãŒã«ã¢ãã¬ã¹>", From = "<éä¿¡å ã®Gmailã¡ãŒã«ã¢ãã¬ã¹>", attr = list(content_type = "text/html", charset = "utf-8", encoding = "base64"), Subject = paste0("There are new released R Packages! (", today(tzone = "UTC"), ")"), body = knitr::kable(df_new_pkg, format = "html")) %>% send_message()
ç§ã¯ããšã§ãã§ãã¯ããããã«Evernoteã®ã¡ãŒã«ã¢ãã¬ã¹ã«éãããšã«ããŸããããã®ãããªæãã§ããŒããäœæãããŸãã
æ¯æå®è¡ãã
äžé£ã®Rã³ãŒãïŒæ°èŠè¿œå ããã±ãŒãžã®ããŒã¿ãã¬ãŒã äœæã{gmailr}
ã§ã®ã¡ãŒã«éä¿¡ïŒãä¿åããŠãããŠããããå®æçã«å®è¡ããããã«ããŸãã以åã«æžãã
ã®ããã«LaunchAgentsãæžããŠãè¯ãã£ãã®ã§ãããäžåç·èªå® ãµãŒããŒæ§ç¯ãªãã¡ãããç®æããŠscheduleRã䜿ããŸããscheduleRã«ã€ããŠã¯ããŸã詳ããæžãäºå®ã§ããããµãŒããŒçµç±ã§Rã³ãŒããShinyã¢ããªã®å®æçã«å®è¡ã§ããããšããããã䟿å©ãªãã®ã§ãã
Enjoy ð