Skip to content

Commit

Permalink
Improve docs for slope_xyz()
Browse files Browse the repository at this point in the history
This fixes another issue in #20 by mentioning alternative functions that can be passed to the fun argument
  • Loading branch information
Robinlovelace committed Sep 3, 2021
1 parent 516f777 commit cb0e2e5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
10 changes: 10 additions & 0 deletions R/slopes.R
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,14 @@ slope_raster = function(

#' Extract slopes from xyz data frame or sf objects
#'
#' The function takes a sf object with 'XYZ' coordinates and returns a vector
#' of numeric values representing the average slope of each linestring in the
#' sf data frame input.
#'
#' The default function to calculate the mean slope is `slope_matrix_weighted()`.
#' You can also use `slope_matrix_mean()` from the package or any other
#' function that takes the same inputs as these functions not in the package.
#'
#' @param route_xyz An sf object with x, y, z dimensions
#' @param lonlat Are the coordinates in lon/lat order? TRUE by default
#' @inheritParams slope_raster
Expand All @@ -264,7 +272,9 @@ slope_raster = function(
#' @examples
#' route_xyz = lisbon_road_segment_3d
#' slope_xyz(route_xyz, lonlat = FALSE)
#' slope_xyz(route_xyz$geom, lonlat = FALSE)
#' slope_xyz(route_xyz, lonlat = FALSE, directed = TRUE)
#' slope_xyz(route_xyz, lonlat = FALSE, fun = slope_matrix_mean)
slope_xyz = function(
route_xyz,
fun = slope_matrix_weighted,
Expand Down
2 changes: 2 additions & 0 deletions man/slope_raster.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion man/slope_xyz.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cb0e2e5

Please sign in to comment.