linux系统中安装R包

摘要:
getDTthreads).Latestnews:r-datatable.com˃dir()[1]“result.map”˃testclass(test)[1]“data.table”“data.frame”˃dim(test)[1]5334534˃头部(test)V1V2V3V41:1oard3_ OAR1_1721180.0203308172182:1oard3_OAR1_206580.0243928206583:1oard_3OAR1_2829960.0334116282964:1oard_3 OAR1_3115520.0367840311525:oard3_OAR1_3381750.0450767381756:1oard_1oard3_可拨打OAR1_ 382640.045181738264。

1、查看R版本

[root@centos8 test]# R --version
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

2、启动R

[root@centos8 test]# R

R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

>

3, 测试data.table包

> library(data.table)
Error in library(data.table) : there is no package called ‘data.table’

4、安装data.table包

镜像列表:https://cran.r-project.org/mirrors.html

> install.packages('data.table', repos='https://mirror.lzu.edu.cn/CRAN/')
…………
…………
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (data.table)

The downloaded source packages are in/tmp/Rtmpaq8Ble/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

5、测试data.dable包

> library(data.table)
data.table 1.13.6 using 1 threads (see ?getDTthreads).  Latest news: r-datatable.com
> dir()
[1] "result.map"
> test <- fread("result.map")
> class(test)
[1] "data.table" "data.frame"
> dim(test)
[1] 533453      4
> head(test)
   V1              V2        V3    V4
1:  1 oar3_OAR1_17218 0.0203308 17218
2:  1 oar3_OAR1_20658 0.0243928 20658
3:  1 oar3_OAR1_28296 0.0334116 28296
4:  1 oar3_OAR1_31152 0.0367840 31152
5:  1 oar3_OAR1_38175 0.0450767 38175
6:  1 oar3_OAR1_38264 0.0451817 38264

可以调用。

6、测试ggplot2包

> library(ggplot2)
Error in library(ggplot2) : there is no package called ‘ggplot2’

7、安装ggplot2包

> install.packages('ggplot2', repos='https://mirror.lzu.edu.cn/CRAN/')
…………
…………
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (ggplot2)

The downloaded source packages are in/tmp/Rtmpaq8Ble/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

8、测试ggplot2包

> library(ggplot2)
> ggplot(mtcars,aes(x=wt,y=mpg)) + geom_point()
> dir()
[1] "result.map" "Rplots.pdf"
> ggsave('1.pdf',dpi = 1080)
Saving 7 x 7 in image
> dir()
[1] "1.pdf"      "result.map" "Rplots.pdf"

可以调用。

免责声明:文章转载自《linux系统中安装R包》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇C#动态属性赋值/取值Unity3D去掉全屏时的屏幕黑边下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

linux下zookeeper的安装教程

zookeeper有单机、伪集群、集群三种部署方式,可根据自己对可靠性的需求选择合适的部署方式。下边对这三种部署方式逐一进行讲解。 注意安装之前必须确认主机已安装jdk,zookeeper的运行依赖java运行环境。 单机: 下载链接:http://archive.apache.org/dist/zookeeper/ 1、 准备好zookeeper安装包,...

Linux逻辑卷管理LVM学习总结

LVM(Logical Volume Manager),它是Linux环境下对磁盘分区进行管理的一种机制,LVM是建立在硬盘和分区之上的一个逻辑层,可以弹性的增加或减小分区的大小,使得磁盘分区管理更具灵活性。LVM的实现示意图: 创建LVM实例: 1、首先创建3个准备组成卷组VG的物理分区,并且把分区格式改为8e。以/dev/sdb1、/dev/sdb2...

Linux下添加php的zip模块

./configure --with-php-config=/usr/local/php/bin/php-config extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/zip.so Linux下添加php的zip模块 今天早上开发的人员过来跟我说,测试机上的XX项目...

Linux 修改PostgreSQL外部访问白名单

1. 查找配置文件 # find / -name pg_hba.conf # find / -name postgresql.conf 2.修改 2.1 修改pg_hba.conf 查找IPv4 local connections 修改默认的 host all all 127.0.0.1/32 trust 为 host all all 192.168.1...

linux下ifconfig, DNS以及route配置

转载:http://blog.csdn.net/wangjingfei/article/details/5283632/ 熟悉使用ifconfig 会非常方便。   ifconfig eth0 新ip   然后编辑/etc/sysconfig/network-scripts/ifcfg-eth0,修改ip   一、修改IP地址   [aeolus@db1...

linux系统磁盘管理(磁盘阵列)

1、磁盘阵列简介 RAID(Redundant Array of Independent Disks)即独立硬盘冗余阵列,简称磁盘阵列。磁盘阵列是由很多价格较便宜的磁盘,以硬件(RAID卡)或软件(MDADM)形式组合成一个容量巨大的磁盘组,利用多个磁盘组合在一起,提升整个磁盘系统效能。利用这项技术,将数据切割成许多区段,分别存放在各个硬盘上。其中RAID...