forked from positioning/kalmanfilter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.r
49 lines (45 loc) · 1.75 KB
/
install.r
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
## Small script to install KF geolocation packages and the packages it depend on
## Modified from Anders Nielsen and Benjamin Galuardi
## Last edited Dec 21 2017
## Upgrading to ncdf4
## by Chi Hin (Tim) Lam <[email protected]>
kf.install <- function(x64=FALSE, ver)
{
pack <- c('date','ncdf4','devtools','httr')
spack <- installed.packages()[,"Package"]
for (i in pack){
if (!any(i == spack)) install.packages(i, repos="http://cran.rstudio.com/")
}
require(httr) # For https download
dlink <-"https://github.com/positioning/kalmanfilter/raw/master/downloads/R3x/"
os <- Sys.info()[['sysname']]
lext <- c('.tar.gz')
pac <- c('kftrack', 'ukfsst', 'trackit')
ver <- c('_0.70', '_0.3', '_0.2-6')
if (os == "Windows") {
for (i in 1:3) {
lfile <- paste(pac[i],ver[i],lext, sep='')
llink <- paste(dlink, ifelse(x64, '64bit', '32bit'),'/win/' ,pac[i], ver[i], ifelse(x64, '-x64', ''), lext ,sep='')
GET(llink, write_disk(lfile, overwrite=TRUE))
install.packages(lfile, .libPaths()[1], repos = NULL, type='source')
unlink(lfile)
}
} else if (os == "Darwin") {
for (i in 1:3) {
lfile <- paste(pac[i], lext, sep='')
llink <- paste(dlink, ifelse(x64, '64bit', '32bit'), '/mac/' , pac[i], ver[i], ifelse(x64, '-x64', ''), lext ,sep='')
GET(llink, write_disk(lfile, overwrite=TRUE))
install.packages(lfile, .libPaths()[1], repos = NULL, type='source')
unlink(lfile)
}
} else {
for (i in 1:3) {
lfile <- paste(pac[i], lext, sep='')
llink <- paste(dlink, ifelse(x64, '64bit', '32bit'), '/linux/' ,pac[i], ver[i], ifelse(x64, '-x64', ''), lext ,sep='')
GET(llink, write_disk(lfile, overwrite=TRUE))
install.packages(lfile, repos = NULL, type='source')
unlink(lfile)
}
}
}
kf.install(F)