-
Notifications
You must be signed in to change notification settings - Fork 0
/
trait_scaling_AppendixS4.R
207 lines (156 loc) · 4.75 KB
/
trait_scaling_AppendixS4.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
##########################################
#
# L. Giraldo-Kalil 19 marzo 2021
#
# Relaciones pareadas de escalamiento entre rasgos funcionales de
# cuatro especies de Damburneya
#
#
##########################################
library(here)
library(readxl)
library(smatr)
#Cargar archivo
datos <- read_excel(here("Datos","Finales", "Sp_trait_values.xlsx"))
colnames(datos)
str(datos)
#convertir en factores variables categoricas
tmp_factor <- c("species","Altitude", "Plot", "Id_Tree")
datos[tmp_factor] <- lapply(datos[tmp_factor], factor)
str(datos)
View(datos)
# Convartir datos en data.frame
datos<-as.data.frame(datos)
str(datos)
#####################################
######################################
# Hacer análisis pareados de correlaciones
#con el paquete smatr usando escala logaritmica
#Se crean también gráficos para revisar el análisis
#_________LNmass
LNmass_LPmass= sma(LNmass ~ LPmass * species, log = "xy",
robust=T,
data = datos)
summary(LNmass_LPmass)
plot(LNmass_LPmass)
plot(LNmass_LPmass, which="residual")
LNmass_SLA= sma(LNmass ~ SLA * species, log = "xy",
robust=T,
data = datos)
summary(LNmass_SLA)
plot(LNmass_SLA)
plot(LNmass_SLA, which="residual")
LNmass_LDMC= sma(LNmass ~ LDMC * species, log = "xy",
robust=T,
data = datos)
summary(LNmass_LDMC)
plot(LNmass_LDMC)
plot(LNmass_LDMC, which="residual")
#____________LPmass
LPmass_SLA= sma(LPmass ~ SLA * species, log = "xy",
robust=T,
data = datos)
summary(LPmass_SLA)
plot(LPmass_SLA)
plot(LPmass_SLA, which="residual")
LPmass_LDMC= sma(LPmass ~ LDMC * species, log = "xy",
robust=T,
data = datos)
summary(LPmass_LDMC)
plot(LPmass_LDMC)
plot(LPmass_LDMC, which="residual")
LPmass_LNmass= sma(LPmass ~ LNmass * species, log = "xy",
robust=T,
data = datos)
summary(LPmass_LNmass)
plot(LPmass_LNmass)
plot(LPmass_LNmass, which="residual")
#________________LeafN:P
LeafNP_SLA= sma(LeafNP ~ SLA * species, log = "xy",
robust=T,
data = datos)
summary(LeafNP_SLA)
plot(LeafNP_SLA)
plot(LeafNP_SLA, which="residual")
LeafNP_LDMC= sma(LeafNP ~ LDMC * species, log = "xy",
robust=T,
data = datos)
summary(LeafNP_LDMC)
plot(LeafNP_LDMC, which="residual")
LeafNP_LNmass= sma(LeafNP ~ LNmass * species, log = "xy",
robust=T,
data = datos)
summary(LeafNP_LNmass)
plot(LeafNP_LNmass)
plot(LeafNP_LNmass, which="residual")
LeafNP_LPmass= sma(LeafNP ~ LPmass * species, log = "xy",
robust=T,
data = datos)
summary(LeafNP_LPmass)
plot(LeafNP_LPmass)
plot(LeafNP_LPmass, which="residual")
#___________________SLA
SLA_LNmass= sma(SLA ~ LNmass * species, log = "xy",
robust=T,
data = datos)
summary(SLA_LNmass)
plot(SLA_LNmass)
plot(SLA_LNmass, which="residual")
SLA_LPmass= sma(SLA ~ LPmass * species, log = "xy",
robust=T,
data = datos)
summary(SLA_LPmass)
plot(SLA_LPmass)
plot(SLA_LPmass, which="residual")
SLA_LeafNP= sma(SLA ~ LeafNP * species, log = "xy",
robust=T,
data = datos)
summary(SLA_LeafNP)
plot(SLA_LeafNP)
plot(SLA_LeafNP, which="residual")
#_________________________________
LDMC_SLA= sma(LDMC ~ SLA * species, log = "xy",
robust=T,
data = datos)
summary(LDMC_SLA)
plot(LDMC_SLA)
plot(LDMC_SLA, which="residual")
LDMC_LNmass= sma(LDMC ~ LNmass * species, log = "xy",
robust=T,
data = datos)
summary(LDMC_LNmass)
plot(LDMC_LNmass)
plot(LDMC_LNmass, which="residual")
LDMC_LPmass= sma(LDMC ~ LPmass * species, log = "xy",
robust=T,
data = datos)
summary(LDMC_LPmass)
plot(LDMC_LPmass)
plot(LDMC_LPmass, which="residual")
LDMC_LeafNP= sma(LDMC ~ LeafNP * species, log = "xy",
robust=T,
data = datos)
summary(LDMC_LeafNP)
plot(LDMC_LeafNP)
plot(LDMC_LeafNP, which="residual")
#___________Adicionales
#_ EXPORTAR RESULTADOS
sink(here("Resultados","Scalingtraits_AppendixS4.csv"))
summary(LNmass_LPmass)
summary(LNmass_SLA)
summary(LNmass_LDMC)
summary(LPmass_SLA)
summary(LPmass_LDMC)
summary(LPmass_LNmass)
summary(LeafNP_SLA)
summary(LeafNP_LDMC)
summary(LeafNP_LNmass)
summary(LeafNP_LPmass)
summary(SLA_LNmass)
summary(SLA_LPmass)
summary(SLA_LeafNP)
summary(LDMC_LNmass)
summary(LDMC_LPmass)
summary(LDMC_LeafNP)
summary(LDMC_SLA)
sink()