# message=FALSE, 
library(tidyverse)
library(plotly)
library(sf)
m <- readxl::read_excel("metals.xlsx")
gis_points <- st_read("large_points.shp")
## Reading layer `large_points' from data source 
##   `C:\Users\ans\Documents\large_points.shp' using driver `ESRI Shapefile'
## Simple feature collection with 12 features and 2 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: 60.1239 ymin: 55.23208 xmax: 61.74485 ymax: 55.71518
## Geodetic CRS:  WGS 84
lakes <- st_read("lines_detailed.shp")
## Reading layer `lines_detailed' from data source 
##   `C:\Users\ans\Documents\lines_detailed.shp' using driver `ESRI Shapefile'
## Simple feature collection with 76 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: 0 ymin: 0 xmax: 61.74768 ymax: 55.71779
## CRS:           NA

R Markdown

This is an R Markdown document. You can look more in google. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

Cu

p <- ggplot(m, aes(Cu_soil, Cu_plants, color = distance_to_road)) + 
    geom_point() + 
    theme_bw() + 
    theme(legend.position = "bottom")
ggplotly(p)

Zn

p <- ggplot(m, aes(Zn_soil, Zn_plants)) + 
    geom_point()
ggplotly(p)

Ni

p <- ggplot(m, aes(Ni_soil, Ni_plants)) + 
    geom_point()
ggplotly(p)

Maps

Static

ggplot() + 
    geom_sf(data = gis_points)

    geom_sf(data = lakes)
## [[1]]
## mapping:  
## geom_sf: na.rm = FALSE
## stat_sf: na.rm = FALSE
## position_identity 
## 
## [[2]]
## <ggproto object: Class CoordSf, CoordCartesian, Coord, gg>
##     aspect: function
##     backtransform_range: function
##     clip: on
##     crs: NULL
##     datum: crs
##     default: TRUE
##     default_crs: NULL
##     determine_crs: function
##     distance: function
##     draw_panel: function
##     expand: TRUE
##     fixup_graticule_labels: function
##     get_default_crs: function
##     is_free: function
##     is_linear: function
##     label_axes: list
##     label_graticule: 
##     labels: function
##     limits: list
##     lims_method: cross
##     modify_scales: function
##     ndiscr: 100
##     params: list
##     range: function
##     record_bbox: function
##     render_axis_h: function
##     render_axis_v: function
##     render_bg: function
##     render_fg: function
##     reverse: none
##     setup_data: function
##     setup_layout: function
##     setup_panel_guides: function
##     setup_panel_params: function
##     setup_params: function
##     train_panel_guides: function
##     transform: function
##     super:  <ggproto object: Class CoordSf, CoordCartesian, Coord, gg>

Interactive

library(leaflet)

gis_points <- mutate(
    gis_points,
    id = 1:nrow(gis_points), 
    gislabes = paste("Это точка №", id)
)

leaflet() %>% 
    addTiles() %>% 
    addMarkers(data = gis_points, label = ~id, popup  = ~gislabes)