## Warning: package 'leaflet' was built under R version 4.2.2
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6      ✔ purrr   0.3.5 
## ✔ tibble  3.1.8      ✔ dplyr   1.0.10
## ✔ tidyr   1.2.1      ✔ stringr 1.4.1 
## ✔ readr   2.1.3      ✔ forcats 0.5.2 
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## Warning: package 'rgeos' was built under R version 4.2.2
## Loading required package: sp
## rgeos version: 0.5-9, (SVN revision 684)
##  GEOS runtime version: 3.9.3-CAPI-1.14.3 
##  Please note that rgeos will be retired by the end of 2023,
## plan transition to sf functions using GEOS at your earliest convenience.
##  GEOS using OverlayNG
##  Linking to sp version: 1.5-0 
##  Polygon checking: TRUE 
## 
## Linking to GEOS 3.9.1, GDAL 3.4.3, PROJ 7.2.1; sf_use_s2() is TRUE

Ejemplo de matriz

##   order     locality Station   day      time                    species
## 1 cap_1 restauracion       1 44826 0.3194444         milvago_chimachima
## 2 cap_2 restauracion       1 44826 0.3472222           amazilia_tzacatl
## 3 cap_3 restauracion       1 44826 0.3680556           turdus_ignobilis
## 4 cap_4 restauracion       1 44826 0.3680556           turdus_ignobilis
## 5 cap_5 restauracion       1 44826 0.3888889        stilpnia_vitriolina
## 6 cap_6 restauracion       1 44826 0.4097222 anthracothorax_nigricollis
##           specie  Net.    Latitude    Longitude      Gremio
## 1  M. chimachima Red_9 3.344095174 -76.55235951   Carnivoro
## 2     A. tzacatl Red_8 3.344512761 -76.55223316 Nectarivoro
## 3   T. ignobilis Red_7 3.344715553 -76.55241358    Omnivoro
## 4   T. ignobilis Red_7 3.344715553 -76.55241358    Omnivoro
## 5  S. vitriolina Red_1 3.345617065 -76.55158278   Frugivoro
## 6 A. nigricollis Red_4 3.345176531  -76.5508456 Nectarivoro
## `summarise()` has grouped output by 'locality', 'Station', 'Net.', 'Longitude'.
## You can override using the `.groups` argument.
## Warning in eval(substitute(list(...)), `_data`, parent.frame()): NAs introduced
## by coercion

## Warning in eval(substitute(list(...)), `_data`, parent.frame()): NAs introduced
## by coercion
##   locality Station   Net. Longitude Latitude sp
## 1   bosque       1  Red_1 -76.55227 3.343468  4
## 2   bosque       1 Red_10 -76.55313 3.343636  2
## 3   bosque       1 Red_12 -76.55345 3.344611  1
## 4   bosque       1  Red_2 -76.55263 3.343885  5
## 5   bosque       1  Red_2 -76.55263 3.343885  1
## 6   bosque       1  Red_3 -76.55282 3.343476  1
## OGR data source with driver: ESRI Shapefile 
## Source: "D:\biato\Dagma-Icesi\R_dagma\Aves\html_aves\para_carbono_corazon.shp", layer: "para_carbono_corazon"
## with 3 features
## It has 6 fields
## 'data.frame':    66 obs. of  6 variables:
##  $ locality : chr  "bosque" "bosque" "bosque" "bosque" ...
##  $ Station  : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Net.     : chr  "Red_1" "Red_10" "Red_12" "Red_2" ...
##  $ Longitude: num  -76.6 -76.6 -76.6 -76.6 -76.6 ...
##  $ Latitude : num  3.34 3.34 3.34 3.34 3.34 ...
##  $ sp       : num  4 2 1 5 1 1 1 2 1 1 ...
##    locality            Station          Net.             Longitude     
##  Length:66          Min.   :1.000   Length:66          Min.   :-76.56  
##  Class :character   1st Qu.:1.000   Class :character   1st Qu.:-76.56  
##  Mode  :character   Median :1.000   Mode  :character   Median :-76.55  
##                     Mean   :1.394                      Mean   :-76.55  
##                     3rd Qu.:2.000                      3rd Qu.:-76.55  
##                     Max.   :2.000                      Max.   :-76.55  
##                                                        NA's   :4       
##     Latitude           sp        
##  Min.   :3.343   Min.   : 1.000  
##  1st Qu.:3.344   1st Qu.: 1.000  
##  Median :3.345   Median : 2.500  
##  Mean   :3.345   Mean   : 3.288  
##  3rd Qu.:3.346   3rd Qu.: 4.000  
##  Max.   :3.347   Max.   :16.000  
##  NA's   :4
m <- leaflet(Mu2) %>% addPolygons(data=states, 
                                  weight = 2, color = "white") %>% 
  addTiles()  %>% addProviderTiles("Esri.WorldImagery") %>% 
  setView( lat=3.3448, lng=-76.554 , zoom=15.49) %>%
  addCircleMarkers(~Longitude, ~Latitude,
                   fillColor = ~mypalette(sp), 
                   fillOpacity = 5, color="white", radius=5, stroke=FALSE,
                   label = mytext,
                   labelOptions = labelOptions( style = list("font-weight" = "normal",
                                                             padding = "3px 8px"),
                                                textsize = "13px",
                                                direction = "auto")
  ) %>%
  addLegend( pal=mypalette, values=~sp, opacity=0.9, title = "Capturas",
             position = "bottomright" ) 
## Warning in validateCoords(lng, lat, funcName): Data contains 4 rows with either
## missing or invalid lat/lon values and will be ignored
## Warning in mypalette(sp): Some values were outside the color scale and will be
## treated as NA

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.