Skip to content

Commit 362d63f

Browse files
committed
small agr mods
1 parent 697ab24 commit 362d63f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

R/agr.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ st_set_agr = function(x, value) {
8686

8787
summarize_agr = function(x) {
8888
su = summary(st_agr(x))
89-
paste(paste(su, names(su)), collapse = ", ")
89+
su = su[su > 0]
90+
paste(paste0(names(su), " (", su, ")"), collapse = ", ")
9091
}
9192

9293
all_constant = function(x) {

R/sf.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ print.sf = function(x, ..., n = getOption("sf_max_print", default = 10)) {
401401
nf = length(x) - length(geoms)
402402
app = paste("and", nf, ifelse(nf == 1, "field", "fields"))
403403
if (any(!is.na(st_agr(x))))
404-
app = paste0(app, "\n", "Attribute-geometry relationship: ", summarize_agr(x))
404+
app = paste0(app, "\n", "Attribute-geometry relationship", ifelse(nf > 1, "s: ", ": "), summarize_agr(x))
405405
if (length(geoms) > 1)
406406
app = paste0(app, "\n", "Active geometry column: ", attr(x, "sf_column"))
407407
print(st_geometry(x), n = 0, what = "Simple feature collection with", append = app)

0 commit comments

Comments
 (0)