Skip to content

Commit

Permalink
add \dontrun{} to examples to pass Debian CRAN check
Browse files Browse the repository at this point in the history
  • Loading branch information
polettif committed Jun 23, 2023
1 parent d43a7cc commit 820398b
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 22 deletions.
7 changes: 0 additions & 7 deletions R/dates.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ convert_dates <- function(gtfs_obj, parse_function = parse_gtfsio_date) {
#'
#' @keywords internal
#' @importFrom stats reshape
#' @examples
#' library(dplyr)
#' local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit")
#' nyc <- read_gtfs(local_gtfs_path)
#' nyc_services_by_date <- nyc$.$dates_services
#' # count the number of services running on each date
#' nyc_services_by_date %>% group_by(date) %>% count()
set_dates_services <- function(gtfs_obj) {
has_calendar = feed_contains(gtfs_obj, "calendar") && nrow(gtfs_obj[["calendar"]]) > 0
has_calendar_dates = feed_contains(gtfs_obj, "calendar_dates") && nrow(gtfs_obj[["calendar_dates"]]) > 0
Expand Down
8 changes: 5 additions & 3 deletions R/geo.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#' among all stops for large feeds should be avoided
#'
#' @examples
#' \dontrun{
#' library(dplyr)
#'
#' nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit")
Expand All @@ -34,7 +35,7 @@
#' #> 9 423S 232S 91.5
#' #> 10 232 423 91.5
#' #> # … with 26 more rows
#'
#' }
#' @export
stop_distances = function(gtfs_stops) {
stopifnot(nrow(gtfs_stops) > 1)
Expand Down Expand Up @@ -98,7 +99,8 @@ prep_dist_mtrx = function(dist_list) {
#' number of stop ids within that group (n_stop_ids) and distance summary values
#' (dist_mean, dist_median and dist_max).
#'
#' @examples
#' @examples
#' \dontrun{
#' library(dplyr)
#'
#' nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit")
Expand All @@ -119,7 +121,7 @@ prep_dist_mtrx = function(dist_list) {
#' #> 9 7 Av <dbl [9 × 9]> 9 5479. 5479. 10753.
#' #> 10 111 St <dbl [9 × 9]> 9 3877. 3877. 7753.
#' #> # … with 370 more rows
#'
#' }
#' @export
stop_group_distances = function(gtfs_stops, by = "stop_name") {
distances <- n_stop_ids <- dist_mean <- dist_median <- dist_max <- NULL
Expand Down
2 changes: 2 additions & 0 deletions R/time.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ replace_NA_times = function(stop_times) {
#' are interpolated equally between stops.
#' @return tidygtfs or stop_times with interpolated arrival and departure times
#' @examples
#' \dontrun{
#' data(gtfs_duke)
#' print(gtfs_duke$stop_times[1:5, 1:5])
#'
Expand All @@ -114,6 +115,7 @@ replace_NA_times = function(stop_times) {
#'
#' gtfs_duke_3 = interpolate_stop_times(gtfs_duke, FALSE)
#' print(gtfs_duke_3$stop_times[1:5, 1:5])
#' }
#' @export
interpolate_stop_times = function(x, use_shape_dist = TRUE) {
....event_time <- ....shape_dist_traveled <- NULL
Expand Down
20 changes: 19 additions & 1 deletion R/validate_gtfs.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@
#' }
#'
#' @examples
#' validate_gtfs(gtfs_duke)
#' #> # A tibble: 233 × 8
#' #> file file_spec file_provided_status field field_spec field_provided_status
#' #> <chr> <chr> <lgl> <chr> <chr> <lgl>
#' #> 1 agency req TRUE agenc… opt TRUE
#' #> 2 agency req TRUE agenc… req TRUE
#' #> 3 agency req TRUE agenc… req TRUE
#' #> 4 agency req TRUE agenc… req TRUE
#' #> 5 agency req TRUE agenc… opt TRUE
#' #> 6 agency req TRUE agenc… opt TRUE
#' #> 7 agency req TRUE agenc… opt TRUE
#' #> 8 agency req TRUE agenc… opt FALSE
#' #> 9 stops req TRUE stop_… req TRUE
#' #> 10 stops req TRUE stop_… opt TRUE
#' #> # 223 more rows
#' #> # 2 more variables: validation_status <chr>, validation_details <chr>
#'
#' \dontrun{
#' local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit")
#' gtfs <- read_gtfs(local_gtfs_path)
#' attr(gtfs, "validation_result")
Expand All @@ -52,7 +70,7 @@
#' # should raise a warning
#' gtfs$stop_times <- NULL
#' validation_result <- validate_gtfs(gtfs)
#'
#' }
#' @export
validate_gtfs <- function(gtfs_obj, files = NULL, warnings = TRUE) {

Expand Down
2 changes: 2 additions & 0 deletions man/interpolate_stop_times.Rd

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

8 changes: 0 additions & 8 deletions man/set_dates_services.Rd

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

3 changes: 2 additions & 1 deletion man/stop_distances.Rd

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

3 changes: 2 additions & 1 deletion man/stop_group_distances.Rd

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

20 changes: 19 additions & 1 deletion man/validate_gtfs.Rd

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

0 comments on commit 820398b

Please sign in to comment.