Skip to content

Commit

Permalink
🎨 Update function to string spatialtemporal event object
Browse files Browse the repository at this point in the history
  • Loading branch information
NONONOexe committed Sep 16, 2024
1 parent 1c97dd2 commit 9338d33
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 7 additions & 4 deletions R/create-spatiotemporal-event.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Create a Spatiotemporal Event Collection
#' Create a spatiotemporal event collection
#'
#' This function creates a spatiotemporal event collection object from
#' a given `sf` object, allowing spatial and temporal data to be
Expand Down Expand Up @@ -45,14 +45,17 @@ create_spatiotemporal_event.sf <- function(x,
return(x)
}

#' @rdname create_spatiotemporal_event
#' @export
print.spatiotemporal_event <- function(x, ...) {
cat("Spatiotemporal event collection with",
nrow(x), "events and", ncol(x) - 2, "fields\n")
cat("Geometry: ", as.character(unique(st_geometry_type(x))), "\n")
cat("Time column: ", attr(x, "time_column"), "\n")
cat("Time format: ", attr(x, "time_format"), "\n")
cat("Geometry type:", as.character(unique(st_geometry_type(x))), "\n")
cat("Time column: ", attr(x, "time_column"), "\n")
cat("Time format: ", attr(x, "time_format"), "\n")
cat("Data:\n")
print(as.data.frame(x)[1:5, ])
if (5 < nrow(x)) cat("...", nrow(x) - 5, "more events\n")

return(invisible(x))
}
5 changes: 4 additions & 1 deletion man/create_spatiotemporal_event.Rd

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

0 comments on commit 9338d33

Please sign in to comment.