Schefferville - sedges 2; Classification of sedges as specialists/generalists based on habitat types

Tammy L. Elliott

Date: March 22, 2015

R version 3.1.0

# set global chunk options: 
library(knitr)
opts_chunk$set(cache=FALSE, fig.align='center', fig.width=11.8, fig.height=8)
library("vegan")
library(plyr)

allplot.hab<-read.csv("Sedges_2_all_plots_hab.csv", head=TRUE, row.names=1)
hab.allplot<-allplot.hab[,c(1:9)]

Habitat types with abundances for each sedge species

D - Disturbed \ F - Fen \ H - Heath \ LF - Lichen forest \ R - Rocks \ SH - Shoreline \ SM - Spruce moss forest \ T - tundra \ TP - tundra ponds

vegcom.ab<-read.csv("Sedges_2_specialist_generalist_abundance.csv", head=TRUE, row.names=1)
vegcom.ab
##     D  F H LF R SH SM  T TP
## AQU 0 18 1  0 0  1  0  0  0
## BIG 0  0 1  0 0  1  0 18  0
## LEN 0  3 0  0 1 11  2  1  2
## OLI 0 19 0  0 0  1  0  0  0
## ROS 0 20 0  0 0  0  0  0  0
## SAX 0 12 1  0 0  4  0  1  2
## UTR 0 16 0  0 0  4  0  0  0
## VES 0  2 0  0 0 18  0  0  0
## BRU 2  4 2  1 2  2  4  3  0
## CAN 0 15 0  0 1  3  0  1  0
## HEL 0 19 0  0 0  0  1  0  0
## TEN 0 20 0  0 0  0  0  0  0
## TRI 0 15 0  0 0  0  5  0  0
## ANG 0 18 1  0 0  0  0  1  1
## EVA 0  7 0  2 1  2  5  2  1
## VIR 0 20 0  0 0  0  0  0  0
## ALP 0 19 0  0 1  0  0  0  0
## CAP 0  6 0  0 0  0  0 14  0
## CES 0 15 0  0 0  1  0  4  0
## CHO 0 20 0  0 0  0  0  0  0
## DEF 2  0 2  3 3  5  2  3  0
## DIS 0 15 0  0 0  1  4  0  0
## ECH 0 16 0  1 0  3  0  0  0
## EXI 0 20 0  0 0  0  0  0  0
## GYN 0 16 0  0 0  1  3  0  0
## LEP 0 15 0  0 0  2  3  0  0
## LIM 0 19 0  0 0  1  0  0  0
## LIV 0 20 0  0 0  0  0  0  0
## MAG 0 10 0  1 0  3  4  0  1
## PAU 0 19 0  0 0  0  1  0  0
## RAR 0 17 0  0 0  0  1  1  1
## RUS 0 18 0  0 0  1  0  0  1
## SCI 0  2 1  0 0  1  4 12  0
## STY 0  9 0  1 0  7  2  0  1
## VAG 0  4 2  2 0  1  8  2  1

Calculations to correct for different sampling efforts per habitat type

### Calculate relative habitat number
rel.hab.number<-colSums(vegcom.ab)/700
#inverse of relative habitat number
rel.hab.number.inv<-1/rel.hab.number

#Try weighting diversity of inverse of habitat abundances
D<-hab.allplot$D*175
F<-hab.allplot$F* 1.495726
H<-hab.allplot$H*63.636364
LF<-hab.allplot$LF*63.636364
R<-hab.allplot$R*77.777778
SH<-hab.allplot$SH*9.459459
SM<-hab.allplot$SM*14.285714
T<-hab.allplot$T* 11.111111
TP<-hab.allplot$TP*63.636364

#Create new dataframe with rownames based on inverse of habitat abundances
vegcom.inv.weighted<-cbind(D, F, H, LF, R, SH, SM, T, TP)
vegcom.row.names=c("AQU", "BIG", "LEN", "OLI", "ROS", "SAX", "UTR", "VES", "BRU", "CAN", "HEL", "TEN", "TRI", "ANG", "EVA", "VIR", "ALP", "CAP", "CES",
 "CHO", "DEF", "DIS", "ECH", "EXI", "GYN","LEP", "LIM", "LIV", "MAG" ,"PAU", "RAR", "RUS", "SCI", "STY" ,"VAG")

vegcom.inv.weighted.names.df<-data.frame(vegcom.inv.weighted, row.names=c ("AQU", "BIG", "LEN", "OLI", "ROS", "SAX", "UTR", "VES", "BRU", "CAN", "HEL", "TEN", "TRI", "ANG", "EVA", "VIR", "ALP", "CAP", "CES",
 "CHO", "DEF", "DIS", "ECH", "EXI", "GYN","LEP", "LIM", "LIV", "MAG" ,"PAU", "RAR", "RUS", "SCI", "STY" ,"VAG"))

Sedge abundances corrected for different sampling efforts per habitat type

str(vegcom.inv.weighted.names.df)
## 'data.frame':    35 obs. of  9 variables:
##  $ D : num  175 0 0 0 0 0 0 0 350 0 ...
##  $ F : num  282.7 16.5 12 55.3 98.7 ...
##  $ H : num  190.9 63.6 0 0 0 ...
##  $ LF: num  63.6 63.6 0 0 0 ...
##  $ R : num  77.8 0 77.8 0 0 ...
##  $ SH: num  104.1 18.9 132.4 28.4 0 ...
##  $ SM: num  114.3 42.9 57.1 0 0 ...
##  $ T : num  33.3 344.4 11.1 0 0 ...
##  $ TP: num  63.6 127.3 127.3 0 0 ...
vegcom.inv.weighted.names.df
##       D          F         H        LF         R         SH        SM
## AQU 175 282.692214 190.90909  63.63636  77.77778 104.054049 114.28571
## BIG   0  16.452986  63.63636  63.63636   0.00000  18.918918  42.85714
## LEN   0  11.965808   0.00000   0.00000  77.77778 132.432426  57.14286
## OLI   0  55.341862   0.00000   0.00000   0.00000  28.378377   0.00000
## ROS   0  98.717916   0.00000   0.00000   0.00000   0.000000   0.00000
## SAX   0  29.914520  63.63636   0.00000   0.00000  66.216213   0.00000
## UTR   0  82.264930   0.00000   0.00000   0.00000  75.675672  28.57143
## VES   0  16.452986   0.00000   0.00000  77.77778 227.027016  28.57143
## BRU 350   5.982904 127.27273  63.63636 155.55556  75.675672  71.42857
## CAN   0  70.299122  63.63636 127.27273 155.55556 132.432426  42.85714
## HEL   0  37.393150   0.00000   0.00000   0.00000   0.000000  14.28571
## TEN   0  80.769204   0.00000   0.00000   0.00000  56.756754  14.28571
## TRI   0  62.820492  63.63636  63.63636   0.00000  47.297295 128.57143
## ANG   0  65.811944 127.27273   0.00000   0.00000  56.756754  14.28571
## EVA   0  14.957260   0.00000 254.54546  77.77778  18.918918  71.42857
## VIR   0  53.846136   0.00000   0.00000  77.77778   0.000000   0.00000
## ALP   0 104.700820   0.00000   0.00000  77.77778   0.000000  28.57143
## CAP   0  11.965808  63.63636  63.63636   0.00000   0.000000  28.57143
## CES   0 237.820434   0.00000  63.63636  77.77778  66.216213  85.71428
## CHO   0  65.811944   0.00000   0.00000   0.00000   9.459459  14.28571
## DEF 525   1.495726 127.27273 190.90909 233.33333  47.297295  28.57143
## DIS   0  38.888876   0.00000   0.00000   0.00000   9.459459  57.14286
## ECH   0  68.803396   0.00000  63.63636   0.00000  66.216213  14.28571
## EXI   0  43.376054   0.00000   0.00000   0.00000   0.000000   0.00000
## GYN   0  91.239286  63.63636  63.63636  77.77778  18.918918 100.00000
## LEP   0  92.735012  63.63636  63.63636   0.00000  28.378377 100.00000
## LIM   0 242.307612   0.00000   0.00000   0.00000  28.378377  14.28571
## LIV   0 113.675176   0.00000   0.00000   0.00000   0.000000  14.28571
## MAG   0 219.871722  63.63636 254.54546  77.77778 236.486475 214.28571
## PAU   0  98.717916   0.00000  63.63636   0.00000  47.297295  28.57143
## RAR   0  76.282026  63.63636   0.00000  77.77778   0.000000  71.42857
## RUS   0  82.264930   0.00000   0.00000   0.00000  56.756754   0.00000
## SCI   0   8.974356 127.27273   0.00000   0.00000  18.918918  57.14286
## STY   0  22.435890   0.00000  63.63636   0.00000  85.135131  28.57143
## VAG   0 130.128162 190.90909 254.54546 155.55556 113.513508 342.85714
##             T        TP
## AQU  33.33333  63.63636
## BIG 344.44444 127.27273
## LEN  11.11111 127.27273
## OLI   0.00000   0.00000
## ROS   0.00000   0.00000
## SAX  22.22222 190.90909
## UTR   0.00000  63.63636
## VES  11.11111  63.63636
## BRU  33.33333  63.63636
## CAN  44.44444  63.63636
## HEL   0.00000   0.00000
## TEN   0.00000  63.63636
## TRI   0.00000  63.63636
## ANG  22.22222 127.27273
## EVA  22.22222  63.63636
## VIR  11.11111   0.00000
## ALP  22.22222  63.63636
## CAP 166.66666   0.00000
## CES 144.44444 190.90909
## CHO   0.00000   0.00000
## DEF  44.44444   0.00000
## DIS   0.00000   0.00000
## ECH   0.00000  63.63636
## EXI   0.00000   0.00000
## GYN  22.22222 127.27273
## LEP  33.33333 127.27273
## LIM  11.11111   0.00000
## LIV   0.00000   0.00000
## MAG  44.44444 254.54546
## PAU   0.00000  63.63636
## RAR  11.11111  63.63636
## RUS   0.00000  63.63636
## SCI 288.88889  63.63636
## STY  11.11111 127.27273
## VAG 111.11111 190.90909

Distribution of frequency sampling across different habitats

# Not corrected for habitat type
vegcom.hab<-colSums(vegcom.ab)
vegcom.hab
##   D   F   H  LF   R  SH  SM   T  TP 
##   4 468  11  11   9  74  49  63  11
# Corrected of different "sampling efforts" per habitat type
vegcom.hab.weighted<-colSums(vegcom.inv.weighted.names.df)
vegcom.hab.weighted
##        D        F        H       LF        R       SH       SM        T 
## 1050.000 2737.179 1463.636 1781.818 1477.778 1872.973 1857.143 1466.667 
##       TP 
## 2481.818
#dev.new(width=11.8, height=6)
par(mfrow=c(1,2))
barplot(vegcom.hab, names=c("Disturbed", "Fen", "Heath", "Lichen forest", "Rocks",
    "Shoreline", "Spruce Moss", "Tundra", "Tundra Pond"), las=2, col="gray40", ylab="Frequency", 
    main="Frequency of sampling in \ndifferent habitat types", cex.axis=0.8,
    cex=0.8, cex.main=1)

barplot(vegcom.hab.weighted, names=c("Disturbed", "Fen", "Heath", "Lichen forest", "Rocks",
    "Shoreline", "Spruce Moss", "Tundra", "Tundra Pond"), las=2, col="gray40", ylab="Frequency", 
    main="Frequency of sampling in different habitat \ntypes corrected by sampling effort", cex.axis=0.8,
    cex=0.8, cex.main=1)

plot of chunk plot.one.freq

Calculate Shannon's diversity of focals species weighted by inverse habitat abundance values

H.inv<-diversity(vegcom.inv.weighted.names.df)

Rescale between 0 and 1

H.inv.rescale<-rescale(H.inv, to=c(0,1), range(H.inv, na.rm = TRUE))

Remove C. deflexa because it is an outlier

These are the results that are inputed into further analyzes.

 H.inv.no.def<-H.inv[c(1:20, 22:35)]
 H.inv.nodef.rescale<-rescale(H.inv.no.def, to=c(0,1), range(H.inv.no.def, na.rm = TRUE))
 H.inv.nodef.sort<-sort(H.inv.nodef.rescale)
 H.low.high.names.nodef.inv<-names(H.inv.nodef.sort)

#write.csv(file="C:/Users/TLElliott/My Documents/PhD/Year4/Schefferville_sedges_2/Analyzes/H.inv.rescale.no.def.allplots.csv", x= H.inv.nodef.rescale)

Plot sedge species (excluding C. deflexa) based on specialization-generalization rank

H.inv.sort<-sort(H.inv.nodef.rescale)
H.low.high.names.inv<-names(H.inv.sort)

#plot(H.inv.sort, pch=16, cex=0.8, col="black")
#text(H.inv.sort, labels=H.low.high.names.inv, cex=0.4, pos=1, offset=0.2)

plot(H.inv.sort, type="n", axes=FALSE, ann=FALSE,xlim=c(0,35), ylim=c(0,1), cex.lab=2, font.lab=4, pch=16)
axis(1, cex.axis=1.25)
axis(2, las=2, cex.axis=1.25)
mtext("Species rank", side=1, line=3)
mtext("Rank value", side=2, line=3)
text(H.inv.sort, labels=H.low.high.names.inv, cex=0.6, pos=1, offset=0.2)
mtext("Sedge species ranked based on \nhabitat classification of specialization", side=3, line=1.5, cex=1.25)
points(H.inv.sort, cex=0.9, col="black", pch=16)
box(bty="l", lwd=2)

plot of chunk plot.gen.spec

#write.csv(file="C:/Users/TLElliott/My Documents/PhD/Year4/Schefferville_sedges_2/Analyzes/H.inv.rescale.no.alp.no.def.allplots.csv", x=H.inv.noalp.nodef.rescale)