Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Feb 14, 2025
1 parent e68d618 commit cd7506d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions R/stars.R
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,11 @@ st_coordinates.dimensions = function(x, ...) {
#' @param add_coordinates logical; if `TRUE`, columns with dimension values preceed the array values,
#' otherwise they are omitted
as.data.frame.stars = function(x, ..., add_max = FALSE, center = NA, add_coordinates = TRUE) {
if (add_coordinates) {
coords = st_coordinates(x, add_max = add_max, center = center, ...)
setNames(
data.frame(coords, lapply(x, function(y) structure(y, dim = NULL))),
c(names(coords), names(x))
)
}
df = setNames(as.data.frame(lapply(x, function(y) structure(y, dim = NULL))), names(x))
if (add_coordinates)
cbind(st_coordinates(x, add_max = add_max, center = center, ...), df)
else
setNames(as.data.frame(lapply(x, function(y) structure(y, dim = NULL))), names(x))
df
}

add_units = function(x) {
Expand Down

0 comments on commit cd7506d

Please sign in to comment.