From 4c7e2077d8fe271ed08804e66b6daecb606311ab Mon Sep 17 00:00:00 2001 From: Robin Lovelace Date: Fri, 3 Sep 2021 22:33:33 +0100 Subject: [PATCH] Update slope_raster example for #37 --- R/slopes.R | 2 +- man/slope_raster.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/slopes.R b/R/slopes.R index dd96fec..35e36c9 100644 --- a/R/slopes.R +++ b/R/slopes.R @@ -222,13 +222,13 @@ slope_matrices = function(m_xyz_split, fun = slope_matrix_weighted, ...) { #' (rows representing linestrings) in the input object. #' @export #' @examples +#' library(sf) #' routes = lisbon_road_network[1:3, ] #' dem = dem_lisbon_raster #' (s = slope_raster(routes, dem)) #' cor(routes$Avg_Slope, s) #' slope_raster(routes, dem, directed = TRUE) #' # Demonstrate that reverse routes have the opposite directed slope -#' library(sf) #' slope_raster(st_reverse(routes), dem, directed = TRUE) slope_raster = function( routes, diff --git a/man/slope_raster.Rd b/man/slope_raster.Rd index 5f19a63..bd284cb 100644 --- a/man/slope_raster.Rd +++ b/man/slope_raster.Rd @@ -58,12 +58,12 @@ geometries to \code{LINESTRING}s as follows: \code{r_linestring = sf::st_cast(routes, "LINESTRING")}. } \examples{ +library(sf) routes = lisbon_road_network[1:3, ] dem = dem_lisbon_raster (s = slope_raster(routes, dem)) cor(routes$Avg_Slope, s) slope_raster(routes, dem, directed = TRUE) # Demonstrate that reverse routes have the opposite directed slope -library(sf) slope_raster(st_reverse(routes), dem, directed = TRUE) }