Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco De Lucia
RedModRphree
Commits
965132d3
Commit
965132d3
authored
May 07, 2018
by
Marco De Lucia
Browse files
Trying and fix the package load
parent
9eb709c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/Surr_Train.R
View file @
965132d3
...
...
@@ -2,7 +2,7 @@
### Marco De Lucia, delucia@gfz-potsdam.de, 2009-2018
### Janis Jatnieks, janisj@gfz-potsdam.de, jatnieks@janis.es
### Time-stamp: "Last modified 2018-05-0
6 23:23
:1
5
delucia"
### Time-stamp: "Last modified 2018-05-0
7 00:06
:1
9
delucia"
### Licence: LGPL version 2.1
## resolve dependencies automatically
...
...
@@ -24,7 +24,7 @@ start_up <- function(session_path=FALSE, ## to disable set to a non-string
## testing
"cluster"
,
"stringr"
,
"gtools"
,
#"ftsa",
"amap"
),
install
=
FALS
E
,
install
=
TRU
E
,
use_cores
=
4
)
{
gc
()
...
...
@@ -36,22 +36,24 @@ start_up <- function(session_path=FALSE, ## to disable set to a non-string
## load session data first
if
(
class
(
session_path
)[
1
]
==
"character"
&
file.exists
(
session_path
)
)
{
cat
(
"Loading..."
,
session_path
)
msg
(
"Loading..."
,
session_path
)
load
(
session_path
,
.GlobalEnv
)
cat
(
" OK
!\n
"
)
msg
(
" OK"
)
}
## loading the right data is important!
## check install and load neccessary packages
cat
(
"Checking for required packages...
\n
"
)
msg
(
"Checking for required packages..."
)
new.packages
<-
list.of.packages
[
!
(
list.of.packages
%in%
installed.packages
()[,
"Package"
])]
if
(
length
(
new.packages
))
{
cat
(
"Need to install these packages:"
,
new.packages
,
"\n"
)
if
(
install
)
{
install.packages
(
new.packages
)
libpath
<-
readline
(
prompt
=
"Please specify the absolute path where the packages will be installed (e.g., '~/Rdevel'): \n"
)
cat
(
" Afterwards, remember to store this path somewhere for R to find it again, such as R_LIBS_USER='~/Rdevel' in ~/.Renviron\n"
)
install.packages
(
new.packages
,
lib
=
libpath
)
}
}
else
cat
(
"Package checks OK!
\n
"
)
}
else
msg
(
"Package checks OK!"
)
loadsuccess
<-
lapply
(
list.of.packages
,
require
,
character.only
=
TRUE
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment