Leer datos del master Excel

library(readxl)
ardisiamaster <- read_excel("Ardidia_elliptica.xlsx")
head(ardisiamaster)
## # A tibble: 6 x 10
##   DatabaseId PrincipalCollec… CollectionYear CountryName MajorRegion
##   <chr>      <chr>                     <dbl> <chr>       <chr>      
## 1 UPRRP      Axelrod, F.S.              1994 Puerto Rico San Juan   
## 2 UPRRP      Axelrod, F.S.              2001 Puerto Rico Hatillo    
## 3 UPRRP      Graveson, R.               2005 Saint Lucia Castries   
## 4 UPRRP      Graveson, R.               2005 Saint Lucia Castries   
## 5 UPRRP      Axelrod, F.S.              1986 Puerto Rico San Sebast…
## 6 UPRRP      Almodóvar, D.              1992 Puerto Rico San Juan   
## # … with 5 more variables: LatitudeDecimal <dbl>, LongitudeDecimal <dbl>,
## #   Altitude <dbl>, HabitatDescription <chr>, PlantDescription <chr>

Colectas por año

Cálculo de la frecuencia de colectas por año.

library(dplyr)
accumyear <- ardisiamaster %>% group_by(CollectionYear) %>% summarise(n = n())
# primeras seis filas del archivo creado "accumyear"
head(accumyear)
## # A tibble: 6 x 2
##   CollectionYear     n
##            <dbl> <int>
## 1           1879     1
## 2           1895     1
## 3           1899     1
## 4           1903     1
## 5           1906     1
## 6           1908     2

Gráfica de colectas por año

library(ggplot2)
ggplot(data = accumyear, 
       aes(x = CollectionYear, y = n)) + 
  ylab("Colectas") +
  xlab("Año") +
  geom_bar(stat = "identity", width = 1, fill = "green")

Gráfica de acumulación anual de colectas

library(ggplot2)
ggplot(data = accumyear, 
       aes(x = CollectionYear, y = n)) + 
  ylab("Colectas") +
  xlab("Año") +
  geom_line(aes(y = cumsum(n)))

Colectores

library(dplyr)
collyear <- ardisiamaster %>%
  group_by(PrincipalCollector) %>% 
  tally()
# primeras seis filas del archivo "collyear"
head(collyear)
## # A tibble: 6 x 2
##   PrincipalCollector        n
##   <chr>                 <int>
## 1 A. Duss                   2
## 2 Acevedo-Rodríguez, P.     7
## 3 Ackerman, J.D.            4
## 4 Almodóvar, D.             1
## 5 Annable, C. R.            1
## 6 Areces Berazain, F.       1

Gráfica de barras por colector

library(ggplot2)
ggplot(data = collyear, 
       aes(x = PrincipalCollector, y = n)) +
  ylab("Colectas") +
  xlab("Colector") +
  geom_bar(stat="identity", width = 1, fill = "blue") +
   theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

Histograma de elevación

Gráfica de frecuencias (histograma) de la elevación; las barras representan 50 m.

library(ggplot2)
ggplot(ardisiamaster, aes(x=Altitude))+
  geom_histogram(binwidth = 50, color="darkblue", fill="lightblue") +
  xlab("Altura, m.s.n.m.") +
  ylab("Especímenes")