R包管理神器batata包_2021-01-23

## 1.设置当前工作

setwd("./batata")

## 2.安装和导入R包

# install.packages("batata")

#

# You can install the development version of batata from Github

# install.packages("remotes")

# remotes::install_github("feddelegrand7/batata")

library(batata)

## 3.R包功能测试

### 3.1 Get Help

help(package="batata")

# Package: batata

# Type: Package

# Title: Managing Packages Removal and Installation

# Version: 0.2.0

# Author: Mohamed El Fodil Ihaddaden

# Maintainer: Mohamed El Fodil Ihaddaden <ihaddaden.fodeil@gmail.com>

#  Description:

#  Allows the user to manage easily R packages removal and installation. It offers many functions to display installed packages according to

# specific dates and removes them if needed. The user is always prompted when running the removal functions in order to confirm

# the required action. It also provides functions that will install 'Github' starred R packages whether available on 'CRAN' or not.

# License: MIT + file LICENSE

# Encoding: UTF-8

# LazyData: true

# Imports: fs, utils, glue, lubridate, jsonlite, remotes, purrr

# RoxygenNote: 7.1.1

# URL: https://github.com/feddelegrand7/batata

# BugReports: https://github.com/feddelegrand7/batata/issues

# Suggests: knitr, rmarkdown, testthat

# VignetteBuilder: knitr

# NeedsCompilation: no

# Packaged: 2021-01-23 00:08:37 UTC; Administrateur

# Repository: CRAN

# Date/Publication: 2021-01-23 06:30:12 UTC

# Built: R 3.6.3; ; 2021-01-23 12:31:44 UTC; windows

### 3.2 R Main Function

ls(package:batata)

# [1] "display_most_starred"  "display_starred"        "fresh_start"

# [4] "install_most_starred"  "install_starred_cran"  "install_starred_github"

# [7] "latest_packages"        "rm_latest_packages"    "rm_since_packages"

# [10] "rm_today_packages"      "rm_yesterday_packages"  "since_packages"

# [13] "today_packages"        "yesterday_packages"

vignette(package = "batata")

# The goal of batata is to help R users manage R packages removals. For example, imagine you’re attending tomorrow an R meet up in which you’ll experiment many packages that you don’t want to keep. By the end of the meet up, you’ll have to remember each installed package, its name (trust me, packages’ names may be complicated). Further, each installed package comes with a bunch of dependency which makes the operations more complicated. Using the batata package, you can just run rm_today_packages() (one of many other functions), and you’re clean for today. Before removing the packages, batata will prompt you to confirm your decision (which adds a certain degree of security), you can also run today_packages() to check all the today installed packages before making a decision.

#

# batata takes into account the modification time of the packages instead of the birth time. As such, if you decide to update a package to a newer version, batata will consider it as a new package (which is technically true as a new package will be installed).

### 3.3 fresh_start()

#@ 这个函数比较危险,它会把你安装的所有R包进行删除卸载,所以执行该函数时会让你确认两次后再行动

?fresh_start

# Remove all the installed R packages from a specified library

# Usage

# fresh_start(lib = .libPaths())

### 3.4 today_packages() and rm_today_packages()

?today_packages

# Displays the packages installed in the current day

# Usage

# today_packages(lib = .libPaths())

today_packages()

# [1] "backports"  "batata"    "gam"        "GNRS"      "htmltools"  "lidR"

# [7] "margins"    "paradox"    "plm"        "quantreg"  "rlas"      "Rmpfr"

# [13] "robustbase" "sfheaders"  "VIM"        "WDI"

?rm_yesterday_packages

# Remove the packages installed yesterday

### 3.5 since_packages and rm_since_packages()

?since_packages

# Displays installed packages according to a specific date

since_packages(date = Sys.Date(), position = "at")

# [1] "backports"  "batata"    "gam"        "GNRS"      "htmltools"  "lidR"

# [7] "margins"    "paradox"    "plm"        "quantreg"  "rlas"      "Rmpfr"

# [13] "robustbase" "sfheaders"  "VIM"        "WDI"

### 3.6 latest_packages() and rm_latest_packages()

?latest_packages

# Displaying the latest installed R packages

latest_packages(10)

# packages  modification_time

# 1      batata 2021-01-23 20:31:45

# 2        VIM 2021-01-23 19:05:29

# 3  sfheaders 2021-01-23 19:05:27

# 4  robustbase 2021-01-23 19:05:26

# 5      Rmpfr 2021-01-23 19:05:25

# 6        rlas 2021-01-23 19:05:23

# 7    quantreg 2021-01-23 19:05:22

# 8        lidR 2021-01-23 19:05:21

# 9  htmltools 2021-01-23 19:05:20

# 10        gam 2021-01-23 19:05:20

?rm_latest_packages

# Remove the n latest installed R packages

### 3.7 display_most_starred

# Display the most starred R Github Repositories

display_most_starred(n = 20)

# [1] "ggplot2"                  "awesome-R"

# [3] "shiny"                    "dplyr"

# [5] "ML_for_Hackers"          "swirl_courses"

# [7] "AnomalyDetection"        "r4ds"

# [9] "bookdown"                "awesome-network-analysis"

# [11] "devtools"                "rmarkdown"

# [13] "knitr"                    "plotly"

# [15] "benchm-ml"                "patchwork"

# [17] "nyc-taxi-data"            "investing"

# [19] "gganimate"                "DataScienceR"

### 3.8 display_starred

# Display User's Github Starred Repositories

display_starred("JING-XINXING", n = 5, onlyR = FALSE)

# [1] "jill.py"

# [2] "toil"

# [3] "luigi"

# [4] "bpipe"

# [5] "BigDataScript"

### 3.9 install_most_starred

# Install the most starred CRAN packages

install_most_starred(n = 5)

# the following repositories, if availables on CRAN, will be installed:

#  ggplot2, awesome-R, shiny, dplyr, ML_for_Hackers

# Installing package into ‘C:/Users/lenovo/Documents/R/win-library/3.6’

# (as ‘lib’ is unspecified)

# 试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.6/ggplot2_3.3.3.zip'

# Content type 'application/zip' length 4073676 bytes (3.9 MB)

# downloaded 3.9 MB

#

# package ‘ggplot2’ successfully unpacked and MD5 sums checked

#

# The downloaded binary packages are in

# C:\Users\lenovo\AppData\Local\Temp\RtmpohYG0I\downloaded_packages

# Installing package into ‘C:/Users/lenovo/Documents/R/win-library/3.6’

# (as ‘lib’ is unspecified)

# Installing package into ‘C:/Users/lenovo/Documents/R/win-library/3.6’

# (as ‘lib’ is unspecified)

# 试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.6/shiny_1.5.0.zip'

# Content type 'application/zip' length 5355486 bytes (5.1 MB)

# downloaded 5.1 MB

#

# package ‘shiny’ successfully unpacked and MD5 sums checked

#

# The downloaded binary packages are in

# C:\Users\lenovo\AppData\Local\Temp\RtmpohYG0I\downloaded_packages

# Installing package into ‘C:/Users/lenovo/Documents/R/win-library/3.6’

# (as ‘lib’ is unspecified)

# 试开URL’https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/3.6/dplyr_1.0.3.zip'

# Content type 'application/zip' length 1536670 bytes (1.5 MB)

# downloaded 1.5 MB

#

# package ‘dplyr’ successfully unpacked and MD5 sums checked

#

# The downloaded binary packages are in

# C:\Users\lenovo\AppData\Local\Temp\RtmpohYG0I\downloaded_packages

# Installing package into ‘C:/Users/lenovo/Documents/R/win-library/3.6’

# (as ‘lib’ is unspecified)

# [[1]]

# [[1]]$result

# NULL

#

# [[1]]$error

# NULL

#

#

# [[2]]

# [[2]]$result

# NULL

#

# [[2]]$error

# NULL

#

#

# [[3]]

# [[3]]$result

# NULL

#

# [[3]]$error

# NULL

#

#

# [[4]]

# [[4]]$result

# NULL

#

# [[4]]$error

# NULL

#

#

# [[5]]

# [[5]]$result

# NULL

#

# [[5]]$error

# NULL

#

#

# Warning messages:

# 1: package ‘awesome-R’ is not available (for R version 3.6.3)

# 2: package ‘ML_for_Hackers’ is not available (for R version 3.6.3)

### 3.10 install_starred_cran

# installs the Github starred packages from CRAN

install_starred_cran(github_user, n = 5)

### 3.11 install_starred_github

# Install Github Starred Packages from Github

install_starred_github(github_user, n = 5, upgrade = "never")

## 4.结尾

sessionInfo()

# R version 3.6.3 (2020-02-29)

# Platform: x86_64-w64-mingw32/x64 (64-bit)

# Running under: Windows 10 x64 (build 18363)

#

# Matrix products: default

#

# locale:

#  [1] LC_COLLATE=Chinese (Simplified)_China.936

# [2] LC_CTYPE=Chinese (Simplified)_China.936

# [3] LC_MONETARY=Chinese (Simplified)_China.936

# [4] LC_NUMERIC=C

# [5] LC_TIME=Chinese (Simplified)_China.936

#

# attached base packages:

#  [1] stats    graphics  grDevices utils    datasets  methods  base

#

# other attached packages:

#  [1] batata_0.2.0

#

# loaded via a namespace (and not attached):

#  [1] Rcpp_1.0.6          lubridate_1.7.9.2  jsonlite_1.7.2

# [4] magrittr_2.0.1      stats4_3.6.3        zip_2.1.1

# [7] rlang_0.4.10        stringi_1.5.3      curl_4.3

# [10] remotes_2.2.0      fs_1.5.0            S4Vectors_0.24.3

# [13] generics_0.1.0      openxlsx_4.2.3      tools_3.6.3

# [16] glue_1.4.2          purrr_0.3.4        tinytex_0.29

# [19] xfun_0.20          yaml_2.2.1          parallel_3.6.3

# [22] compiler_3.6.3      BiocGenerics_0.32.0

(0)

相关推荐

  • [书籍翻译系列]数据处理必备—R安装

    书籍翻译 好的书籍是人类进步的阶梯,但有些人却找不到优秀的阶梯,为此我们开设了书籍翻译这个栏目,作为你学习之路的指路明灯:分享国内外优秀书籍,弘扬分享精神,做一个知识的传播者. 希望大家能有所收获! ...

  • 这些新开发的R包尝起来确实鲜

    写在前面 翻了翻最近一年来cran上的R包,找了一些对我们很有用的,让当然看不完,进行了简单的了解,这里送给大家,看看是否可以帮助自己做好数据呢? ClinReport 提供输出wrd格式的表格,这个 ...

  • 安装GitHub的R包困难解决方案

    相信遇到这样的问题的朋友不在少数,在中国大陆做数据分析,下载软件数据文件遇到困难那是家常便饭. 比如安装GitHub的R包,因为并不是所有的R包都会被正式的发布在CRAN或者bioconductor, ...

  • Linux的非root用户居然不能安装scater包吗

    最近打算利用生信技能树提供的福利服务器做一些单细胞研究,下载好了数据,打开R准备分析的时候,发现没有'scater'包.想着作为生信技能树的老粉丝,安装R包应该难不倒我. 首先打开R,输入代码:ins ...

  • 【R分享|实战】 新手福利~R包的安装与使用

    " 也许那是过去的你,你无法改变,但现在的你能够变得强大."   --科白君 "R实战"专题·第2篇   编辑 | 科白维尼   4445字 | 7分钟阅读 本 ...

  • 玩转R包

    很长一段时间,总是被安装一些包所绊住,或许今天也是.往往小阴沟就会翻船.死都不敢相信自己是这么死的.R包就是众多坑沟中的臭名昭著的一个.版本不对,依赖不存在,各种问题简直让一个有强迫症的患者生不如死. ...

  • R包的安装与更新

    一.R包的安装 0. 设置镜像 R和bioconductor的主服务器都在国外,设置镜像加快下载速度. ## ====修改镜像====options(repos=c(CRAN="https: ...

  • 【R语言学习3】R语言程序包来源与使用方法简介

    【R语言学习3】R语言程序包来源与使用方法简介

  • 这个“仙县”藏着包粽“神器”,一个粽子70米长也不申请吉尼斯

    万水千山"粽"是情!今年的端午节恰逢一年一度的高考,先祝福所有的学子一举高"粽".在这样一个传统节日里,除了缅怀爱国诗人屈原外,我们心心念念的自然是必不可少的& ...

  • go modules:使用 mod 管理项目依赖包,通过vendor实现一键分发编译包

    在go语言1.11版本之前,没有modules机制,所有软件包都在安装在$GOPATH/src目录下.不同项目如果引用了同一个软件包的不同版本,就会造成编译麻烦.修改$GOPATH变量是当时一种比较简 ...

  • R数据分析:用lme4包拟合线性和非线性混合效应模型

    快一个月没更新文章啦,今天收到好几个粉丝的催更私信,好的吧,实在对不住大家期待的眼神,看样子不能再拖啦,想想写啥好呢,大家咨询比较多的,混合模型算一个,今天就继续给大家写写混合模型如何做吧. 混合模型 ...

  • 小萌新—> Linux高手系列:包管理

    <小萌新 -> Linux高手系列文章>. 今天这篇文章将给大家介绍基于CentOS的包管理. 在Linux操作系统中主要两种形式的包管理形式: 一种形式是压缩包的形式:例如**.t ...

  • 小萌新—> Linux高手系列:包管理【二】

    上期回顾:小萌新-> Linux高手系列:包管理作为一个有追求的测试,如何从一个运维小萌新成长为一个Linux 高手?请持续关注我们的<小萌新 -> Linux高手系列文章>. ...

  • Windows 下的包管理器

    包管理器的概念源自 Linux,与 Windows 单独下载安装软件不同,包管理器可以管理各种软件,做到统一的安装.更新和删除.某种程度上来说,有点类似于应用商店.但由于不同软件之间有着复杂的依赖关系 ...

  • R语言 | 向量化操作purrr包

    Python网络爬虫与文本数据分析 在不少实际问题中有许多具有规律性的重复操作,因此在程序中就需要重复执行某些语句. 问题 比如有一个序列ns,现在想得到res,让ns中每一个数字变为平方数,代码如下 ...

  • R语言 | 数据操作tidyr包

    [更新~]Python网络爬虫与文本数据分析 tidyr包 类似于上图成行成列的表数据是干净数据(tidy data),一般每一行表示一条观测记录,每一列表示一个字段(变量)tidyr包是用来操作ti ...

  • R语言 | jiebaR中文分词包

    [更新~] Python网络爬虫与文本数据分析 jiebaR 中文与英文做文本分析很多时候会多一个分词步骤,因为默认情况下,文本分析软件会默认用空格作为分隔符处理文本,所以很多软件需要先将中文文本分词 ...