-
Notifications
You must be signed in to change notification settings - Fork 1
/
.Rhistory
93 lines (93 loc) · 5.26 KB
/
.Rhistory
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
library(reshape2)
library(dplyr)
facl1 <- data.frame(project = 'FACL1',
species = 'W.acuminata',
traits = c('plant_height', 'biomass', 'flower_number'))
Kunj_seed_mass_per_individual <- read.csv('~/Dropbox/Mayfield Lab/FunctionalTraitDatabase/Projects/LITT1/raw/compiled_Kunj_seed_mass_per_individual.csv',
header = T, stringsAsFactors = F)
litt1 <- data.frame(project = 'LITT1',
species = unique(Kunj_seed_mass_per_individual$Species),
traits = 'seed_mass')
Kunjin_harvest_species <- read.csv('~/Dropbox/Mayfield Lab/FunctionalTraitDatabase/Projects/LITT1/raw/compiled_Kunjin_harvest_species.csv',
header = T, stringsAsFactors = F)
Kunjin_harvest_species <- Kunjin_harvest_species[is.na(Kunjin_harvest_species$Plant.biomass) == F, ] # remove NAs
litt1.2 <- data.frame(project = 'LITT1',
species = unique(Kunjin_harvest_species$Species),
traits = 'biomass')
plant_level_data <- read.csv('~/Dropbox/Mayfield Lab/FunctionalTraitDatabase/Projects/SHAD1/raw/plant_level_data.csv',
header = T, stringsAsFactors = F)
tom_shade <- read.csv('~/Dropbox/Mayfield Lab/FunctionalTraitDatabase/Projects/SHAD1/raw/tom_data.csv',
header = T, stringsAsFactors = F)
shad1.1 <- plant_level_data[ , c('Focal.sp', 'Height', 'Num.fl.total', 'Seedcount.extrap.integer')]
colnames(shad1.1) <- c('species', 'height', 'flower_number', 'seed_number')
shad1.1 <- melt(shad1.1, id.vars = 'species')
shad1.1 <- data.frame(project = 'SHAD1',
species = shad1.1$species,
traits = shad1.1$variable)
shad1.1 <- unique(shad1.1)
tom_shade[tom_shade$species == 'h', ]$species <- 'H.glutinosum'
tom_shade[tom_shade$species == 'c', ]$species <- 'A.calendula'
tom_shade[tom_shade$species == 'p', ]$species <- 'P.airoides'
tom_shade[tom_shade$species == 'v', ]$species <- 'V.rosea'
shad1.2 <- tom_shade[ , c('species', 'Height', 'canopy.arch', 'Longest.Leaf', 'no.developed.flowers', 'Mean.seed.per.flower')]
colnames(shad1.2) <- c('species', 'height', 'canopy.arch', 'longest_leaf', 'flower_number', 'mean_seed_number_per_flower')
shad1.2 <- melt(shad1.2, id.vars = 'species')
shad1.2 <- data.frame(project = 'SHAD1',
species = shad1.2$species,
traits = shad1.2$variable)
shad1.2 <- unique(shad1.2)
plot_data <- read.csv('~/Dropbox/Work/Projects/2017_Coex_Envmt/1.data/raw/watering/2014 plot data cleaned up by Claire.csv',
header = T, stringsAsFactors = F)
plot_data[plot_data$Focal.sp == 'A', ]$Focal.sp <- 'A.calendula'
plot_data[plot_data$Focal.sp == 'H', ]$Focal.sp <- 'H.glabra'
plot_data[plot_data$Focal.sp == 'W', ]$Focal.sp <- 'W.acuminata'
plot_data[plot_data$Focal.sp == 'T', ]$Focal.sp <- 'T.cyanopetala'
watr1 <- plot_data[ , c('Focal.sp', 'Aboveground.biomass.g', 'Belowground.biomass.g', 'Number.flowers.total', 'Seedcount.extrapolated.integer')]
colnames(watr1) <- c('species', 'above_biomass', 'below_biomass', 'flower_number', 'seed_number')
watr1 <- melt(watr1, id.vars = 'species')
watr1 <- na.omit(watr1)
watr1 <- data.frame(project = 'WATR1',
species = watr1$species,
traits = watr1$variable)
tom_shade <- read.csv('~/Dropbox/Mayfield Lab/FunctionalTraitDatabase/Projects/SHAD1/raw/tom_shade.csv',
header = T, stringsAsFactors = F)
shad1.1 <- plant_level_data[ , c('Focal.sp', 'Height', 'Num.fl.total', 'Seedcount.extrap.integer')]
colnames(shad1.1) <- c('species', 'height', 'flower_number', 'seed_number')
shad1.1 <- melt(shad1.1, id.vars = 'species')
shad1.1 <- data.frame(project = 'SHAD1',
species = shad1.1$species,
traits = shad1.1$variable)
shad1.1 <- unique(shad1.1)
tom_shade[tom_shade$species == 'h', ]$species <- 'H.glutinosum'
tom_shade[tom_shade$species == 'c', ]$species <- 'A.calendula'
tom_shade[tom_shade$species == 'p', ]$species <- 'P.airoides'
tom_shade[tom_shade$species == 'v', ]$species <- 'V.rosea'
shad1.2 <- tom_shade[ , c('species', 'Height', 'canopy.arch', 'Longest.Leaf', 'no.developed.flowers', 'Mean.seed.per.flower')]
colnames(shad1.2) <- c('species', 'height', 'canopy.arch', 'longest_leaf', 'flower_number', 'mean_seed_number_per_flower')
shad1.2 <- melt(shad1.2, id.vars = 'species')
shad1.2 <- data.frame(project = 'SHAD1',
species = shad1.2$species,
traits = shad1.2$variable)
shad1.2 <- unique(shad1.2)
plot_data <- read.csv('~/Dropbox/Work/Projects/2017_Coex_Envmt/1.data/raw/watering/2014 plot data cleaned up by Claire.csv',
header = T, stringsAsFactors = F)
plot_data <- read.csv('~/Dropbox/Work/Projects/2017_CoexEnvmt/1.data/raw/watering/2014 plot data cleaned up by Claire.csv',
header = T, stringsAsFactors = F)
plot_data[plot_data$Focal.sp == 'A', ]$Focal.sp <- 'A.calendula'
plot_data[plot_data$Focal.sp == 'H', ]$Focal.sp <- 'H.glabra'
plot_data[plot_data$Focal.sp == 'W', ]$Focal.sp <- 'W.acuminata'
plot_data[plot_data$Focal.sp == 'T', ]$Focal.sp <- 'T.cyanopetala'
watr1 <- plot_data[ , c('Focal.sp', 'Aboveground.biomass.g', 'Belowground.biomass.g', 'Number.flowers.total', 'Seedcount.extrapolated.integer')]
colnames(watr1) <- c('species', 'above_biomass', 'below_biomass', 'flower_number', 'seed_number')
watr1 <- melt(watr1, id.vars = 'species')
watr1 <- na.omit(watr1)
watr1 <- data.frame(project = 'WATR1',
species = watr1$species,
traits = watr1$variable)
watr1 <- unique(watr1)
final.df <- rbind(facl1, litt1, litt1.2, shad1.1, shad1.2, watr1)
View(final.df)
View(final.df)
table(final.df$species)
table(final.df$traits)
write.csv(final.df, '~/Dropbox/Mayfield Lab/FunctionalTraitDatabase/species_traits_list_MB.csv', row.names = F)