inst/doc/ggswissmaps_with_sf.R

## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  dev = "png"
)

## -----------------------------------------------------------------------------
library(ggswissmaps)
# str(shp_sf)  # Very long output...

class(shp_sf)
length(shp_sf)
lapply(shp_sf, class)
names(shp_sf)

## -----------------------------------------------------------------------------
library(ggplot2)
ggplot(shp_sf[["g1k15"]]) + geom_sf()

## -----------------------------------------------------------------------------
ggplot(shp_sf[["g1k15"]]) + 
  geom_sf(fill = NA) + 
  ggswissmaps::theme_white_f()

## -----------------------------------------------------------------------------
library(sf)
st_crs(shp_sf[[1]])

## -----------------------------------------------------------------------------
tmp <- st_transform(shp_sf[[1]], crs = 2056)
st_crs(tmp)

Try the ggswissmaps package in your browser

Any scripts or data that you put into this service are public.

ggswissmaps documentation built on June 23, 2025, 5:09 p.m.