My old summary_rows() code no longer works #1420
Unanswered
joeharvaRd
asked this question in
Q&A
Replies: 3 comments
-
I have the same issue (old working code : here's some reproducable code:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
The correct function to use here is |
Beta Was this translation helpful? Give feedback.
0 replies
-
This should get you back on track, gt was updated and the code for summary rows has changed.
https://posit.co/blog/big-changes-to-making-summary-rows-in-gt-0-9-0/
Posit
posit.co
Joe
Joseph Harvard
Real Estate Analyst
CA Certified Appraiser # AR033903
1363 Spinnaker Drive #149
Ventura CA 93001
e: ***@***.***
c: 707 322 4407
… On Jul 4, 2024, at 2:03 PM, olivroy ***@***.***> wrote:
I think that the correct function to use here is grand_summary_rows() instead of summary_rows()
—
Reply to this email directly, view it on GitHub <#1420 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BCECK5KAKKYCXDNG3W4ER3TZKW2AJAVCNFSM6AAAAABKMDORE2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TSNRSGM3DA>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I get that the code for summary_rows() has changed what I don't understand is what I need to do to get my old code to work. Please help I've spend hours trying to solve this problem.
I have a custom function in the summary_rows code;
fns_labels_exc0 <-
list(
Low = ~min(.[. > 0], na.rm = TRUE),
High = ~max(.[. > 0], na.rm = TRUE),
Median = ~median(.[. > 0], na.rm = TRUE),
Average = ~mean(.[. > 0], na.rm = TRUE))
My old code;
clean_data_b03_1y %>% gt(rowname_col = "mls") |>
tab_header(title = md("Comparable Product - 12 Month Market Summary")) |>
tab_stubhead(label = "MLS Number") |>
tab_options(table.width = pct(100)) |>
fmt_integer(columns = year_built, use_seps = FALSE) |>
fmt_currency(columns = c(concession, original_list_price, close_price),
currency = "USD", decimals = 0) |>
fmt_number(columns = c(living_area, lot_size_sf), decimals = 0) %>%
fmt_percent(columns = olp_cp, decimals = 2) |>
summary_rows(groups = NULL, columns = c(concession, original_list_price, close_price),
fns = fns_labels_exc0, formatter = fmt_currency, decimals = 0)
If I change the summary_rows code to:
summary_rows(groups = everything(), columns = c(concession, original_list_price, close_price),
fns = fns_labels_exc0, formatter = fmt_currency, decimals = 0)
I get this error message;
Error:
!
everything()
must be used within a selecting function.ℹ See ?tidyselect::faq-selection-context for details.
I do not actually have any groups the summary_rows code I have actually target specific columns with column specific formatting i.e. numbers, currency.
If I drop the groups = argument, because its a default, I get the same error message;
summary_rows(columns = c(concession, original_list_price, close_price),
fns = fns_labels_exc0, formatter = fmt_currency, decimals = 0)
Error:
!
everything()
must be used within a selecting function.ℹ See ?tidyselect::faq-selection-context for details.
I'm running
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
R Studio Version 2023.06.2+561 (2023.06.2+561)
package ‘gt’ version 0.9.0
Beta Was this translation helpful? Give feedback.
All reactions