Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HIDDEN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sPlot
HIDDEN
Commits
09de8052
Commit
09de8052
authored
Aug 25, 2020
by
Francesco Sabatini
Browse files
Options
Downloads
Patches
Plain Diff
Minor fixed to 02
parent
a1b4c84c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
02_Mesobromion_ExamineOutput.R
+10
-11
10 additions, 11 deletions
02_Mesobromion_ExamineOutput.R
with
10 additions
and
11 deletions
02_Mesobromion_ExamineOutput.R
+
10
−
11
View file @
09de8052
...
...
@@ -72,10 +72,12 @@ is.binary <- function(x){(all(na.omit(x) %in% 0:1))}
####1.1 Table S3 - Trait recap #####
trait.recap
<-
traits
%>%
mutate_at
(
.vars
=
vars
(
Leaf_Scleroph
,
LifeSpan
,
Rosette
),
.funs
=~
as.ordered
(
.
))
%>%
dplyr
::
select
(
-
ends_with
(
"1"
))
%>%
## exclude two traits that shouldn't be there V_VER_present1 & V_VER_absent1
mutate_if
(
.predicate
=
~
is.numeric
(
.
),
.funs
=~
round
(
.
,
3
))
%>%
summarize_all
(
.funs
=
list
(
xxxType.of.variable
=~
ifelse
(
is.binary
(
.
),
"binary"
,
ifelse
(
is.ordered
(
.
),
"ord
ered
"
,
ifelse
(
is.ordered
(
.
),
"ord
inal
"
,
ifelse
(
is.numeric
(
.
),
"quantitative"
,
ifelse
(
is.factor
(
.
),
"nominal"
,
NA
)))),
xxxLevels
=~
(
...
...
@@ -569,9 +571,7 @@ species.cov <- read_delim("_data/Mesobromion/species.v2.10perc.cov.txt", delim="
#traits <- traits.backup
categorical.traits
<-
colnames
(
traits
)[
which
(
sapply
(
traits
,
"is.factor"
))]
traits
$
LeafPersistence
<-
factor
(
traits
$
LeafPersistence
,
levels
=
c
(
"immergrün"
,
"sommergrün"
,
"überwinternd_grün"
,
"vorsommergrün"
),
labels
=
c
(
"eg"
,
"sg"
,
"wg"
,
"se"
))
#traits$Pollination <- factor(traits$Pollination,
# levels=c("NEKTAR_HONIG_INSEKTEN","POLLEN","WIND" ),
# labels=c("insects", "pollen", "wind"))
...
...
@@ -764,15 +764,14 @@ ggsave("_pics/FigSXXXb_PCA_Fuzzy_2-3_wSpecies.png", width=8, height=8, dpi=300,
#### 4.1 PCA of Y (Bealls) matrix + CWM ####
W.beals
<-
as.data.frame
(
beals
(
species.cov
%>%
column_to_rownames
(
"RELEVE_NR"
)
%>%
mutate_all
(
~
(
.
>
0
)
*
1
),
#transform to p\a
column_to_rownames
(
"RELEVE_NR"
),
include
=
T
,
type
=
2
))
write.table
(
W.beals
,
sep
=
"\t"
,
file
=
"_derived/Mesobromion/MatrixY_Beals.csv"
)
pca.out
<-
rda
(
W.beals
)
varexpl
<-
round
((
pca.out
$
CA
$
eig
)
/
sum
(
pca.out
$
CA
$
eig
)
*
100
,
1
)
cwms.envfit
<-
envfit
(
pca.out
,
CWM.wide
,
na.rm
=
T
,
choices
=
1
:
5
)
env.envfit
<-
envfit
(
pca.out
,
env
%>%
dplyr
::
select
(
Temp
,
Prec
,
pH
=
PHIPHOX
,
C.org
=
ORCDRC
),
choices
=
1
:
5
)
dplyr
::
select
(
Temp
,
Prec
,
pH
=
PHIPHOX
,
C.org
=
ORCDRC
),
choices
=
1
:
4
,
na.rm
=
T
)
### Transform to correlations and sink envfits
### see https://www.davidzeleny.net/anadat-r/doku.php/en:suppl_vars_examples for procedure
...
...
@@ -804,9 +803,9 @@ myvectors <- as.data.frame(env.cor) %>%
bind_rows
(
as.data.frame
(
cwms.cor
)
%>%
rownames_to_column
(
"mylab"
)
%>%
mutate
(
category
=
"Trait"
))
%>%
bind_rows
(
as.data.frame
(
fuzz.cor
)
%>%
rownames_to_column
(
"mylab"
)
%>%
mutate
(
category
=
"Fuzzy-Weighted"
))
%>%
#
bind_rows(as.data.frame(fuzz.cor) %>%
#
rownames_to_column("mylab") %>%
#
mutate(category="Fuzzy-Weighted")) %>%
mutate
(
fontface0
=
ifelse
(
mylab
%in%
best.4traits
,
"bold"
,
"italic"
))
%>%
mutate
(
category
=
as.factor
(
category
))
%>%
mutate
(
mycol
=
ifelse
(
category
==
"Trait"
,
oilgreen
,
orange
))
%>%
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment