From 180d4866009567cf4bf6f55f7db53192f05c43df Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Fri, 16 Sep 2022 13:21:43 +0000 Subject: [PATCH] Install R packages --- roles/classroom/tasks/rstudio.yml | 73 ++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 2 deletions(-) diff --git a/roles/classroom/tasks/rstudio.yml b/roles/classroom/tasks/rstudio.yml index 4a500c3..16bfe87 100644 --- a/roles/classroom/tasks/rstudio.yml +++ b/roles/classroom/tasks/rstudio.yml @@ -1,6 +1,11 @@ -- name: Install R.Studio +- name: Install R win_chocolatey: - name: r.project, r.studio + name: r.project + package_params: /AddToPath + +- name: Install RStudio + win_chocolatey: + name: r.studio - name: Create configuration directory win_file: @@ -16,3 +21,67 @@ win_copy: dest: "%PROGRAMDATA%\\RStudio\\rstudio-prefs.json" content: { "check_for_updates": false } + +#- name: Install packages +# win_command: Rscript - +# args: +# stdin: | +# install.packages(c("tidyverse", "lpSolveAPI", "igraph", "quadprog", "GenSA", "lattice", "tabuSearch", "MASS", "e1071", "metaheuristicOpt", "DEoptim", "DEoptimR") , repos = "http://cran.rstudio.com") +# install.packages(c("rpart", "rpart.plot", "nnet", "CORElearn", "e1071", "randomForest", "kernlab", "kknn", "neuralnet", "keras", "cluster", "RSNNS", "NMF", "class", "reshape2", "arules", "viridisLite", "arulesViz", "bnlearn", "ipred", "adabag", "caret", "smotefamily", "graphics", "aplpack", "Radviz") , repos = "http://cran.rstudio.com") + +- name: Find R directory + win_find: + paths: C:\Program Files\R + patterns: ['R-*'] + file_type: directory + register: base + +- name: Find installed R libraries + win_find: + paths: "{{ base.files[0].path }}\\library" + file_type: directory + register: libs + +- name: Install R packages + win_command: Rscript - + args: + stdin: install.packages(c("{{ item }}"), repos = "http://cran.rstudio.com") + when: item not in (libs.files|map(attribute='filename')) + loop: + - CORElearn + - DEoptim + - DEoptimR + - GenSA + - MASS + - NMF + - RSNNS + - Radviz + - adabag + - aplpack + - arules + - arulesViz + - bnlearn + - caret + - class + - cluster + - e1071 + - graphics + - igraph + - ipred + - keras + - kernlab + - kknn + - lattice + - lpSolveAPI + - metaheuristicOpt + - neuralnet + - nnet + - quadprog + - randomForest + - reshape2 + - rpart + - rpart.plot + - smotefamily + - tabuSearch + - tidyverse + - viridisLite