R/CRAN をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
The Comprehensive R Archive Network, CRAN
&size(10){perlで言う所の CPAN かな. 必要な機能をネット経...
Rを起動して、そのRプロンプト内で
#code(nonumber){{
install.packages("xxxx")
}}
として必要なパッケージを導入する.
っが、これがインターネットに繋がっていれば楽. そうでなく...
簡単には外部の公開されているCPANリポジトリサイトの中身を...
&size(10){外部にアクセス可能な所で必要なパッケージを取得...
&color(red){*};&size(10){外部に直接アクセスできる方は公開...
***コンテンツを取得して閉鎖ネット内webサイトで公開 [#kbc4...
大抵のサイトはrsyncで提供されているようなので、それを使っ...
っでコンテンツ取得. &color(red){*};&size(10){これが正しい...
#code(nonumber){{
[root@out ~]# cd /Public/mirror
[root@out mirror]# rsync -av --delete ftp.yz.yamagata-u.a...
[root@out mirror]# rsync -av --delete ftp.yz.yamagata-u.a...
}}
「--exclude="*"」で全ての選択肢を外して「--include="*.tar...
&size(10){「00Archive」は取得していない. 「00Archive」を...
これで「/Public/mirror」にCRANが溜まる. PACKAGES と confi...
そして溜まった「/Public/mirror」をUSB-HDD/SSDとかにrsync...
っでこのコンテンツのある場所をhttpで(閉鎖ネット内に)公開(...
#code(nonumber){{
[root@c ~]# vi /etc/httpd/conf.d/cran.conf
Alias /src/contrib /Public/mirror/cran/src/contrib
<Directory "/Public/mirror/cran/src/contrib">
Options FollowSymLinks Indexes
AllowOverride none
Require all granted
</Directory>
[root@c ~]# systemctl reload httpd
}}
位置関係
#code(nonumber){{
http://ftp.yz.yamagata-u.ac.jp/pub/cran/src/
+index.html
+manuals.html
:
+bin/
+contrib/
+extra/
+main/...
+...
+...
+...
:
+...
}}
***リポジトリの定義 [#bf1ed6e6]
外部に繋がった計算機でR実行後に「install.packages("xxxxxx...
始めにどこの公開リポジトリを参照しますか?との問いが始まる
っが、ここは閉鎖ネット内なので、お外にはでれずに目的のパ...
なのでお外に出れない代わりに作った閉鎖ネット内のリポジト...
#code(nonumber){{
(Rの中で)
> install.packages("xxxxxx", repos="http://c.sybyl.local"...
(あるいはrepsを定義して)
> options(repos = structure(c(CRAN = "http://c.sybyl.loca...
> getOption("repos") *...
CRAN
"http://c.sybyl.local/"
> install.packages("xxxxxxxx") *...
(設定ファイルなら)
illya@ubuntu:~$ echo "options(repos = structure(c(CRAN = ...
(計算機全体にかける)
root@ubuntu:~# echo "options(repos = structure(c(CRAN = '...
}}
&size(10){計算機全体への適用はRのインストール先が「/apps/...
環境変数に関してはRの中で「Sys.getenv()」を実行するといい...
***パッケージをインストール [#j76066d9]
リポジトリの設定が済んだらパッケージをインストールしてみ...
手始めに dplyr を入れます. &size(10){本家様 [[https://dpl...
#code(nonumber){{
> getOption("repos")
CRAN
"http://c.sybyl.local/"
> install.packages("dplyr")
> installed.packages()
> packageVersion("dplyr")
[1] ‘1.1.3’
>
> help(package=dplyr)
(Rに入っているirisデータを使ってちょいと出力)
> dplyr::slice(iris,1:5)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
>
}}
***Bioconductor [#x4ce81e3]
Rの外部パッケージは CRAN だけでなく Bioconductor(https://...
Rのバージョン毎に適用可能なBioconductorのバージョンがある.
|BGCOLOR(YELLOW):Bioconductorのリリース日|BGCOLOR(YELLOW)...
|2023.10.25|3.18| 4.3.[2,3] ||
|2023.4.26|3.17| 4.3.[0,1] ||
|2022.11.2|3.16| 4.2.[2,3] |epel8/epel9で提供されるRは4.2...
|2022.4.27|3.15| 4.2.[0,1] |~|
|2021.10.27|3.14| 4.1.[2,3]||
|2021.5.20|3.13| 4.1.[0,1] ||
|2020.10.28|3.12| 4.0.[3,4,5] ||
|2020.4.28|3.11| 4.0.[0,1,2] ||
|2019.10.30|3.10| 3.6.[2,3] ||
|2019.3.3|3.9| 3.6.[0,1] |epel7で提供されるRは 3.6.0|
|2018.10.31|3.8| 3.5.[1,2,3] ||
閉鎖ネット内では当然ながらBioconductorへのサイトに行けな...
ここは R-4.3.2 を使っているのでbioconductorの 3.18 を取得...
「/Public/bioconductor/packages/&color(magenta){3.18};/{b...
「/Public/bioconductor/packages/&color(magenta){3.18};/da...
っで取得したデータをwebで公開します
#code(nonumber){{
[root@c ~]# vi /etc/httpd/conf.d/bioconductor.conf
Alias /bioconductor /Public/bioconductor
<Directory "/Public/bioconductor">
Options FollowSymLinks Indexes
AllowOverride none
Require all granted
</Directory>
[root@c ~]# systemctl reload httpd
[root@c ~]# wget https://bioconductor.org/config.yaml -P...
}}
な感じで
っで、「Rprofile.site」はこんな感じにします
#code(nonumber){{
root@ubuntu:~# vi /apps/R-4.3.2/lib/R/etc/Rprofile.site
options(repos = structure(c(CRAN = "http://c.sybyl.local/...
options(BIOCONDUCTOR_CONFIG_FILE="http://c.sybyl.local/bi...
options(BioC_mirror = "http://c.sybyl.local/bioconductor")
root@ubuntu:~#
}}
#code(nonumber){{
> install.packages("BiocManager")
Installing package into ‘/home/saber/.R/4.3.2’
(as ‘lib’ is unspecified)
trying URL 'http://c.sybyl.local/src/contrib/BiocManager_...
Content type 'application/x-gzip' length 582690 bytes (56...
:
:
> BiocManager::install("proActiv")
'getOption("repos")' replaces Bioconductor standard repos...
'help("repositories", package = "BiocManager")' for detai...
Replacement repositories:
CRAN: http://c.sybyl.local/
Bioconductor version 3.18 (BiocManager 1.30.22), R 4.3.2 ...
:
trying URL 'http://c.sybyl.local/src/contrib/sys_3.4.2.ta...
:
trying URL 'http://c.sybyl.local/bioconductor/packages/3....
:
:
> library(proActiv)
Attaching package: ‘proActiv’
The following object is masked from ‘package:stats’:
filter
>
}}
***CentOS7でR-4.3.2を使う [#u30dd564]
R-4.3.2はBioconductor-3.18を参照なのでそれを準備してから
#code(nonumber){{
[root@centos7 ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@centos7 ~]# yum install libxml2-devel openssl-devel...
[root@centos7 ~]# yum install devtoolset-9 ...
[root@centos7 ~]# vi /apps/R-4.3.2/lib64/R/etc/Rprofile.s...
options(repos = structure(c(CRAN = 'http://c.sybyl.local/...
options(BIOCONDUCTOR_CONFIG_FILE="http://c.sybyl.local/bi...
options(BioC_mirror = "http://c.sybyl.local/bioconductor")
[root@centos7 ~]#
}}
#code(nonumber){{
[saber@centos7 ~]$ source scl_source enable devtoolset-9 ...
[saber@centos7 ~]$ module use /apps/modulefiles/
[saber@centos7 ~]$ module load R/4.3.2
[saber@centos7 ~]$ R
> install.packages("BiocManager")
> BiocManager::install("ActiveDriverWGS")
}}
終了行:
The Comprehensive R Archive Network, CRAN
&size(10){perlで言う所の CPAN かな. 必要な機能をネット経...
Rを起動して、そのRプロンプト内で
#code(nonumber){{
install.packages("xxxx")
}}
として必要なパッケージを導入する.
っが、これがインターネットに繋がっていれば楽. そうでなく...
簡単には外部の公開されているCPANリポジトリサイトの中身を...
&size(10){外部にアクセス可能な所で必要なパッケージを取得...
&color(red){*};&size(10){外部に直接アクセスできる方は公開...
***コンテンツを取得して閉鎖ネット内webサイトで公開 [#kbc4...
大抵のサイトはrsyncで提供されているようなので、それを使っ...
っでコンテンツ取得. &color(red){*};&size(10){これが正しい...
#code(nonumber){{
[root@out ~]# cd /Public/mirror
[root@out mirror]# rsync -av --delete ftp.yz.yamagata-u.a...
[root@out mirror]# rsync -av --delete ftp.yz.yamagata-u.a...
}}
「--exclude="*"」で全ての選択肢を外して「--include="*.tar...
&size(10){「00Archive」は取得していない. 「00Archive」を...
これで「/Public/mirror」にCRANが溜まる. PACKAGES と confi...
そして溜まった「/Public/mirror」をUSB-HDD/SSDとかにrsync...
っでこのコンテンツのある場所をhttpで(閉鎖ネット内に)公開(...
#code(nonumber){{
[root@c ~]# vi /etc/httpd/conf.d/cran.conf
Alias /src/contrib /Public/mirror/cran/src/contrib
<Directory "/Public/mirror/cran/src/contrib">
Options FollowSymLinks Indexes
AllowOverride none
Require all granted
</Directory>
[root@c ~]# systemctl reload httpd
}}
位置関係
#code(nonumber){{
http://ftp.yz.yamagata-u.ac.jp/pub/cran/src/
+index.html
+manuals.html
:
+bin/
+contrib/
+extra/
+main/...
+...
+...
+...
:
+...
}}
***リポジトリの定義 [#bf1ed6e6]
外部に繋がった計算機でR実行後に「install.packages("xxxxxx...
始めにどこの公開リポジトリを参照しますか?との問いが始まる
っが、ここは閉鎖ネット内なので、お外にはでれずに目的のパ...
なのでお外に出れない代わりに作った閉鎖ネット内のリポジト...
#code(nonumber){{
(Rの中で)
> install.packages("xxxxxx", repos="http://c.sybyl.local"...
(あるいはrepsを定義して)
> options(repos = structure(c(CRAN = "http://c.sybyl.loca...
> getOption("repos") *...
CRAN
"http://c.sybyl.local/"
> install.packages("xxxxxxxx") *...
(設定ファイルなら)
illya@ubuntu:~$ echo "options(repos = structure(c(CRAN = ...
(計算機全体にかける)
root@ubuntu:~# echo "options(repos = structure(c(CRAN = '...
}}
&size(10){計算機全体への適用はRのインストール先が「/apps/...
環境変数に関してはRの中で「Sys.getenv()」を実行するといい...
***パッケージをインストール [#j76066d9]
リポジトリの設定が済んだらパッケージをインストールしてみ...
手始めに dplyr を入れます. &size(10){本家様 [[https://dpl...
#code(nonumber){{
> getOption("repos")
CRAN
"http://c.sybyl.local/"
> install.packages("dplyr")
> installed.packages()
> packageVersion("dplyr")
[1] ‘1.1.3’
>
> help(package=dplyr)
(Rに入っているirisデータを使ってちょいと出力)
> dplyr::slice(iris,1:5)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
>
}}
***Bioconductor [#x4ce81e3]
Rの外部パッケージは CRAN だけでなく Bioconductor(https://...
Rのバージョン毎に適用可能なBioconductorのバージョンがある.
|BGCOLOR(YELLOW):Bioconductorのリリース日|BGCOLOR(YELLOW)...
|2023.10.25|3.18| 4.3.[2,3] ||
|2023.4.26|3.17| 4.3.[0,1] ||
|2022.11.2|3.16| 4.2.[2,3] |epel8/epel9で提供されるRは4.2...
|2022.4.27|3.15| 4.2.[0,1] |~|
|2021.10.27|3.14| 4.1.[2,3]||
|2021.5.20|3.13| 4.1.[0,1] ||
|2020.10.28|3.12| 4.0.[3,4,5] ||
|2020.4.28|3.11| 4.0.[0,1,2] ||
|2019.10.30|3.10| 3.6.[2,3] ||
|2019.3.3|3.9| 3.6.[0,1] |epel7で提供されるRは 3.6.0|
|2018.10.31|3.8| 3.5.[1,2,3] ||
閉鎖ネット内では当然ながらBioconductorへのサイトに行けな...
ここは R-4.3.2 を使っているのでbioconductorの 3.18 を取得...
「/Public/bioconductor/packages/&color(magenta){3.18};/{b...
「/Public/bioconductor/packages/&color(magenta){3.18};/da...
っで取得したデータをwebで公開します
#code(nonumber){{
[root@c ~]# vi /etc/httpd/conf.d/bioconductor.conf
Alias /bioconductor /Public/bioconductor
<Directory "/Public/bioconductor">
Options FollowSymLinks Indexes
AllowOverride none
Require all granted
</Directory>
[root@c ~]# systemctl reload httpd
[root@c ~]# wget https://bioconductor.org/config.yaml -P...
}}
な感じで
っで、「Rprofile.site」はこんな感じにします
#code(nonumber){{
root@ubuntu:~# vi /apps/R-4.3.2/lib/R/etc/Rprofile.site
options(repos = structure(c(CRAN = "http://c.sybyl.local/...
options(BIOCONDUCTOR_CONFIG_FILE="http://c.sybyl.local/bi...
options(BioC_mirror = "http://c.sybyl.local/bioconductor")
root@ubuntu:~#
}}
#code(nonumber){{
> install.packages("BiocManager")
Installing package into ‘/home/saber/.R/4.3.2’
(as ‘lib’ is unspecified)
trying URL 'http://c.sybyl.local/src/contrib/BiocManager_...
Content type 'application/x-gzip' length 582690 bytes (56...
:
:
> BiocManager::install("proActiv")
'getOption("repos")' replaces Bioconductor standard repos...
'help("repositories", package = "BiocManager")' for detai...
Replacement repositories:
CRAN: http://c.sybyl.local/
Bioconductor version 3.18 (BiocManager 1.30.22), R 4.3.2 ...
:
trying URL 'http://c.sybyl.local/src/contrib/sys_3.4.2.ta...
:
trying URL 'http://c.sybyl.local/bioconductor/packages/3....
:
:
> library(proActiv)
Attaching package: ‘proActiv’
The following object is masked from ‘package:stats’:
filter
>
}}
***CentOS7でR-4.3.2を使う [#u30dd564]
R-4.3.2はBioconductor-3.18を参照なのでそれを準備してから
#code(nonumber){{
[root@centos7 ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@centos7 ~]# yum install libxml2-devel openssl-devel...
[root@centos7 ~]# yum install devtoolset-9 ...
[root@centos7 ~]# vi /apps/R-4.3.2/lib64/R/etc/Rprofile.s...
options(repos = structure(c(CRAN = 'http://c.sybyl.local/...
options(BIOCONDUCTOR_CONFIG_FILE="http://c.sybyl.local/bi...
options(BioC_mirror = "http://c.sybyl.local/bioconductor")
[root@centos7 ~]#
}}
#code(nonumber){{
[saber@centos7 ~]$ source scl_source enable devtoolset-9 ...
[saber@centos7 ~]$ module use /apps/modulefiles/
[saber@centos7 ~]$ module load R/4.3.2
[saber@centos7 ~]$ R
> install.packages("BiocManager")
> BiocManager::install("ActiveDriverWGS")
}}
ページ名:
1