-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathglobal.R
113 lines (98 loc) · 3.42 KB
/
global.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
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
103
104
105
106
107
108
109
110
111
112
# Copyright 2022-2024 Louis Héraut (louis.heraut@inrae.fr)*1,
# Éric Sauquet (eric.sauquet@inrae.fr)*1,
# Michel Lang (michel.lang@inrae.fr)*1,
# Jean-Philippe Vidal (jean-philippe.vidal@inrae.fr)*1,
# Benjamin Renard (benjamin.renard@inrae.fr)*1
#
# *1 INRAE, France
#
# This file is part of MAKAHO R shiny app.
#
# MAKAHO R shiny app is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# MAKAHO R shiny app is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MAKAHO R shiny app.
# If not, see <https://www.gnu.org/licenses/>.
## 1. PACKAGES _______________________________________________________
### 1.1. Library _____________________________________________________
library(shiny)
library(shinyjs)
library(shinyWidgets)
library(leaflet)
library(icons)
library(dplyr)
library(stringr)
library(lubridate)
library(sf)
### 1.2. Source ______________________________________________________
#### 1.2.0. work path ________________________________________________
dev_lib_path =
"/home/lheraut/Documents/INRAE/projects"
# ""
#### 1.2.1. EXstat ___________________________________________________
dev_path = file.path(dev_lib_path,
c('', 'EXstat_project'), 'EXstat', 'R')
if (any(file.exists(dev_path))) {
print('Loading EXstat from local directory')
list_path = list.files(dev_path, pattern='*.R$', full.names=TRUE)
for (path in list_path) {
source(path, encoding='UTF-8')
}
} else {
print('Loading EXstat from package')
library(EXstat)
}
#### 1.2.2. ASHE _____________________________________________________
dev_path = file.path(dev_lib_path,
c('', 'ASHE_project'), 'ASHE', 'R')
if (any(file.exists(dev_path))) {
print('Loading ASHE from local directory')
list_path = list.files(dev_path, pattern='*.R$', full.names=TRUE)
for (path in list_path) {
source(path, encoding='UTF-8')
}
} else {
print('Loading ASHE from package')
library(ASHE)
}
#### 1.2.3. dataSHEEP ________________________________________________
dev_path = file.path(dev_lib_path,
c('', 'dataSHEEP_project'), 'dataSHEEP', 'R')
if (any(file.exists(dev_path))) {
print('Loading dataSHEEP from local directory')
list_path = list.files(dev_path, pattern='*.R$', full.names=TRUE)
for (path in list_path) {
source(path, encoding='UTF-8')
}
} else {
print('Loading dataSHEEP from package')
library(dataSHEEP)
}
## 2. INITIALISATION _________________________________________________
# Check if you are in dev mod
if (dir.exists(dev_lib_path)) {
dev = TRUE
verbose = TRUE
} else {
dev = FALSE
verbose = FALSE
}
# language
lg = "fr"
# Sourcing R files
source('tools.R', encoding='UTF-8')
source('settings.R', encoding='UTF-8')
source('marker_manager.R', encoding='UTF-8')
# Sourcing app
source('server.R', encoding='UTF-8')
source('ui.R', encoding='UTF-8')
# Running app local
shinyApp(ui=ui, server=server)