forked from larsyencken/marelle-deps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
r.pl
102 lines (84 loc) · 2.05 KB
/
r.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
%
% r.pl
% computer-deps
%
% The R statistical language.
%
:- multifile r_pkg/1.
r_cran_mirror('http://cran.ms.unimelb.edu.au/').
pkg(r).
met(r, _) :- which('R').
installs_with_apt(r, 'r-base').
installs_with_brew(r, 'R').
depends(r, osx, ['homebrew-science-tap']).
brew_tap('homebrew-science-tap', 'homebrew/science').
meta_pkg('r-recommended', [
'caret.R',
'reshape.R',
'randomForest.R',
'RColorBrewer.R',
'boot.R',
'tree.R',
'e1071.R',
%'medley.R',
'xts.R',
'maps.R',
'geosphere.R',
'RMySQL.R',
'psych.R'
]).
pkg('caret.R').
depends('caret.R', osx, [gettext]).
pkg('reshape.R').
pkg('randomForest.R').
pkg('RColorBrewer.R').
pkg('boot.R').
pkg('tree.R').
pkg('e1071.R').
pkg('medley.R').
pkg('xts.R').
pkg('maps.R').
pkg('geosphere.R').
pkg('ROAuth.R').
pkg('RCurl.R').
pkg('RMySQL.R').
pkg('psych.R').
pkg('twitteR.R').
depends('twitteR.R', _, ['ROAuth.R', 'RCurl.R']).
pkg(P) :- nonvar(P), cran_pkg(P, _).
cran_pkg(P, PkgName) :-
atom_concat(PkgName, '.R', P).
depends(P, _, [r]) :- cran_pkg(P, _).
met(P, _) :- cran_pkg(P, PkgName), imports_with_r(PkgName).
meet(P, _) :-
cran_pkg(P, Pkg),
r_cran_mirror(M),
( access_file('/usr/local/lib', write) ->
Sudo = ''
;
Sudo = 'sudo '
),
bash([Sudo, 'Rscript -e \'install.packages("', Pkg, '", repos="', M, '")\'']).
imports_with_r(P) :-
bash(['Rscript -e \'library("', P, '")\' >/dev/null 2>/dev/null']).
:- multifile rgithub_pkg/2.
pkg(P) :- rgithub_pkg(P, _).
met(P, _) :- rgithub_pkg(P, _), imports_with_r(P).
depends(P, _, ['devtools.R']) :- rgithub_pkg(P, _).
meet(P, _) :-
rgithub_pkg(P, User),
bash([
'Rscript -e \'',
'library("RCurl"); library("devtools"); devtools::install_github("',
P, '", "', User, '")\''
]).
rgithub_pkg(rga, skardhamar).
rgithub_pkg(assertthat, hadley).
rgithub_pkg(dplyr, hadley).
depends(dplyr, _, [assertthat]).
pkg(gettext).
met(gettext, osx) :-
isfile('/usr/local/lib/libintl.dylib').
meet(gettext, osx) :-
bash('brew install gettext'),
bash('brew link gettext --force').