-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMain_script.R
151 lines (87 loc) · 4.34 KB
/
Main_script.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#===============================================================================
# Configuration and sourcing
#===============================================================================
#load the config file and choose the option best suited for the data
Sys.setenv(R_CONFIG_ACTIVE = "OECD")
#load packages
source('Sourced code/Source.R')
#===============================================================================
# STEP 1: Characterisation of Agroecological Transition (CAET)
#===============================================================================
## Extract data and calculate values for single elements of agroecology
# 1.1 Diversity
Diversity <- caet_diversity()
# 1.2 Synergies
Synergies <- caet_synergies()
# 1.3 Efficiency
Efficiency <- caet_efficiency()
# 1.4 Recycling
Recycling <- caet_recycling()
# 1.5 Resilience
Resilience <- caet_resilience()
# 1.6 Culture and food traditions
Culture <- caet_culture()
# 1.7 Co-creation
Cocreation <- caet_cocreation()
# 1.8 Human & Social values
Humanvalues <- caet_humanvalues()
# 1.9 Circular and solidarity economy
Circular <- caet_circular()
# 1.10 Responsible Governance
Governance <- caet_governance()
## Calculate CAET
CAET <- caet_CAET()
#===============================================================================
# STEP 2: Sustainability. Core Criteria
#===============================================================================
#-------------------------------------------------------------------------------
# 2.1 Dietary Diversity
#-------------------------------------------------------------------------------
DietaryDiv <- step2_Dietary_Diversity()
#-------------------------------------------------------------------------------
# 2.2 Soil Health
#-------------------------------------------------------------------------------
SoilHealth <- step2_SoilHealth( )
#-------------------------------------------------------------------------------
# 2.3 Secure Land Tenure
#-------------------------------------------------------------------------------
Landtenure <- step2_LandTenure()
#-------------------------------------------------------------------------------
# 2.4 Women Empowerment
#-------------------------------------------------------------------------------
WomenEmpowerment <- step2_WomensEmpowerment()
#-------------------------------------------------------------------------------
# 2.5 Youth Employment and Emigration
#-------------------------------------------------------------------------------
YouthScore <- step2_YouthEmploymentEmigration()
#-------------------------------------------------------------------------------
# 2.6 Agricultural Biodiversity
#-------------------------------------------------------------------------------
# There are two Index for Agricultural Biodiversity:
# (1) The standard TAPE Agrobiodiversity Index
# (2) the new biodiversity index developed by Agroscope (Gilgen et al. 2023. DOI: https://doi.org/10.34776/as172e)
# The new biodiversity index needs extra questions during the survey and thus can only be calculated if the extended questionnaire was used!
# Select in the 'config.yml' file if you want to calculate (1) "Agrobiodiversity" or (2) "Biodiversity"
if(cfg$Indicator == "Agrobiodiversity"){
Agricultural_biodiversity <- step2_Agricultural_Biodiversity()
} else if (cfg$Indicator == 'Biodiversity'){
Agricultural_biodiversity <- step2_new_Biodiversity()
}
#-------------------------------------------------------------------------------
# 2.7 Exposure to Pesticides
#-------------------------------------------------------------------------------
Pesticides <- step2_pesticides()
#-------------------------------------------------------------------------------
# 2.8 Productivity - Income - Added Value
#-------------------------------------------------------------------------------
Economy <- step2_economy()
#-------------------------------------------------------------------------------
# 2.9 FIES (Food Insecurity Experience Survey)
#-------------------------------------------------------------------------------
FIES <- step2_fies()
#===============================================================================
# Generate Output Excel-Table
#===============================================================================
#calculate all the data
TAPE <- all_TAPE()
write.xlsx(TAPE, 'TAPE_final.xlsx')