2019年7月23日火曜日

[R] glmnetパッケージをインストール

ターミナルからRを立ち上げます.
$ r

R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.7.0 (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.

During startup - Warning messages:
1: Setting LC_COLLATE failed, using "C" 
2: Setting LC_TIME failed, using "C" 
3: Setting LC_MESSAGES failed, using "C" 
4: Setting LC_MONETARY failed, using "C" 

glmnetがインストールされてない状態でglmnetを読み込もうとしても,以下のようにそのようなパッケージが存在しないと返ってきます.
> library(glmnet)
Error in library(glmnet) : there is no package called ‘glmnet’

インストールは以下のようにして行います.
> install.packages("glmnet")

すると,以下のようにCRANミラーを選択するよう支持されます.
Installing package into ‘/usr/local/lib/R/3.6/site-library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Secure CRAN mirrors 

 1: 0-Cloud [https]                   2: Algeria [https]                
 3: Australia (Canberra) [https]      4: Australia (Melbourne 1) [https]
 5: Australia (Melbourne 2) [https]   6: Australia (Perth) [https]      
 7: Austria [https]                   8: Belgium (Ghent) [https]        
 9: Brazil (PR) [https]              10: Brazil (RJ) [https]            
11: Brazil (SP 1) [https]            12: Brazil (SP 2) [https]          
13: Bulgaria [https]                 14: Chile [https]                  
15: China (Hong Kong) [https]        16: China (Guangzhou) [https]      
17: China (Lanzhou) [https]          18: China (Shanghai) [https]       
19: Colombia (Cali) [https]          20: Czech Republic [https]         
21: Denmark [https]                  22: Ecuador (Cuenca) [https]       
23: Ecuador (Quito) [https]          24: Estonia [https]                
25: France (Lyon 1) [https]          26: France (Lyon 2) [https]        
27: France (Marseille) [https]       28: France (Montpellier) [https]   
29: France (Paris 2) [https]         30: Germany (Erlangen) [https]     
31: Germany (Göttingen) [https]      32: Germany (Münster) [https]      
33: Germany (Regensburg) [https]     34: Greece [https]                 
35: Hungary [https]                  36: Iceland [https]                
37: Indonesia (Jakarta) [https]      38: Ireland [https]                
39: Italy (Padua) [https]            40: Japan (Tokyo) [https]          
41: Japan (Yonezawa) [https]         42: Korea (Busan) [https]          
43: Korea (Gyeongsan-si) [https]     44: Korea (Seoul 1) [https]        
45: Korea (Ulsan) [https]            46: Malaysia [https]               
47: Mexico (Mexico City) [https]     48: Norway [https]                 
49: Philippines [https]              50: Serbia [https]                 
51: Spain (A Coruña) [https]         52: Spain (Madrid) [https]         
53: Sweden [https]                   54: Switzerland [https]            
55: Turkey (Denizli) [https]         56: Turkey (Mersin) [https]        
57: UK (Bristol) [https]             58: UK (London 1) [https]          
59: USA (CA 1) [https]               60: USA (IA) [https]               
61: USA (KS) [https]                 62: USA (MI 1) [https]             
63: USA (MI 2) [https]               64: USA (OR) [https]               
65: USA (TN) [https]                 66: USA (TX 1) [https]             
67: Uruguay [https]                  68: (other mirrors)                

ここでは,40番のJapan(Tokyo)を選択します.
Selection: 40

するとインストール*が始まります.

・・-・ --- --- - -・ --- - ・
* インストール時には以下のように表示されます.
also installing the dependencies ‘iterators’, ‘foreach’

trying URL 'https://cran.ism.ac.jp/src/contrib/iterators_1.0.10.tar.gz'
Content type 'application/x-gzip' length 290575 bytes (283 KB)
==================================================
downloaded 283 KB

trying URL 'https://cran.ism.ac.jp/src/contrib/foreach_1.4.4.tar.gz'
Content type 'application/x-gzip' length 360705 bytes (352 KB)
==================================================
downloaded 352 KB

trying URL 'https://cran.ism.ac.jp/src/contrib/glmnet_2.0-18.tar.gz'
Content type 'application/x-gzip' length 3862714 bytes (3.7 MB)
==================================================
downloaded 3.7 MB

During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
* installing *source* package ‘iterators’ ...
** package ‘iterators’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
** testing if installed package can be loaded from final location
During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
** testing if installed package keeps a record of temporary installation path
* DONE (iterators)
During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
* installing *source* package ‘foreach’ ...
** package ‘foreach’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
** testing if installed package can be loaded from final location
During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
** testing if installed package keeps a record of temporary installation path
* DONE (foreach)
During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
* installing *source* package ‘glmnet’ ...
** package ‘glmnet’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran  -fPIC  -g -O2  -c glmnet5dpclean.f -o glmnet5dpclean.o
clang -I"/usr/local/Cellar/r/3.6.0_3/lib/R/include" -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include  -fPIC  -g -O2  -c glmnet_init.c -o glmnet_init.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.6.0_3/lib/R/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o glmnet.so glmnet5dpclean.o glmnet_init.o -L/usr/local/opt/gcc/lib/gcc/9/gcc/x86_64-apple-darwin17/9.1.0 -L/usr/local/opt/gcc/lib/gcc/9 -lgfortran -lquadmath -lm -L/usr/local/Cellar/r/3.6.0_3/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
installing to /usr/local/lib/R/3.6/site-library/00LOCK-glmnet/00new/glmnet/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
** testing if installed package keeps a record of temporary installation path
* DONE (glmnet)

The downloaded source packages are in
‘/private/var/folders/sd/hzc6sg0j5tj5p340n4h992_r0000gn/T/RtmphxoZOU/downloaded_packages’

0 件のコメント :

コメントを投稿