From fc9f6519b6e34c22fe41580cbeb29b0564979a16 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Thu, 27 Jun 2024 22:39:02 -0400 Subject: [PATCH] Update help files using roxygen --- man/as_latex.Rd | 2 +- man/extract_summary.Rd | 40 ++++++++++++++++++++++++---------------- man/fmt_country.Rd | 28 ++++++++++++++++++++++++---- 3 files changed, 49 insertions(+), 21 deletions(-) diff --git a/man/as_latex.Rd b/man/as_latex.Rd index 616468b89e..3539c851e5 100644 --- a/man/as_latex.Rd +++ b/man/as_latex.Rd @@ -23,7 +23,7 @@ containing the LaTeX code. } \details{ LaTeX packages required to generate tables are: -booktabs, caption, longtable, colortbl, array. +booktabs, caption, longtable, colortbl, array, anyfontsize, multirow. In the event packages are not automatically added during the render phase of the document, please create and include a style file to load them. diff --git a/man/extract_summary.Rd b/man/extract_summary.Rd index 90cb3631aa..0b5ddce1f3 100644 --- a/man/extract_summary.Rd +++ b/man/extract_summary.Rd @@ -55,28 +55,36 @@ rows as a list object. summary_extracted #> $summary_df_data_list #> $summary_df_data_list$W02 -#> group_id row_id rowname date open high low close week -#> 1 W02 min min NA 2005.55 2029.610 1992.440 2002.610 NA -#> 2 W02 max max NA 2063.45 2064.430 2038.330 2062.140 NA -#> 3 W02 avg avg NA 2035.24 2048.562 2016.854 2031.208 NA +#> # A tibble: 3 x 9 +#> group_id row_id rowname date open high low close week +#> +#> 1 W02 min min NA 2006. 2030. 1992. 2003. NA +#> 2 W02 max max NA 2063. 2064. 2038. 2062. NA +#> 3 W02 avg avg NA 2035. 2049. 2017. 2031. NA #> #> $summary_df_data_list$W03 -#> group_id row_id rowname date open high low close week -#> 1 W03 min min NA 1992.250 2018.400 1988.120 1992.67 NA -#> 2 W03 max max NA 2046.130 2056.930 2022.580 2028.26 NA -#> 3 W03 avg avg NA 2020.422 2033.288 1999.772 2014.93 NA +#> # A tibble: 3 x 9 +#> group_id row_id rowname date open high low close week +#> +#> 1 W03 min min NA 1992. 2018. 1988. 1993. NA +#> 2 W03 max max NA 2046. 2057. 2023. 2028. NA +#> 3 W03 avg avg NA 2020. 2033. 2000. 2015. NA #> #> $summary_df_data_list$W04 -#> group_id row_id rowname date open high low close week -#> 1 W04 min min NA 2020.190 2028.940 2004.490 2022.55 NA -#> 2 W04 max max NA 2062.980 2064.620 2050.540 2063.15 NA -#> 3 W04 avg avg NA 2034.557 2048.707 2023.362 2042.41 NA +#> # A tibble: 3 x 9 +#> group_id row_id rowname date open high low close week +#> +#> 1 W04 min min NA 2020. 2029. 2004. 2023. NA +#> 2 W04 max max NA 2063. 2065. 2051. 2063. NA +#> 3 W04 avg avg NA 2035. 2049. 2023. 2042. NA #> #> $summary_df_data_list$W05 -#> group_id row_id rowname date open high low close week -#> 1 W05 min min NA 2002.450 2023.320 1989.180 1994.990 NA -#> 2 W05 max max NA 2050.420 2057.620 2040.970 2057.090 NA -#> 3 W05 avg avg NA 2030.484 2039.186 2008.986 2021.008 NA +#> # A tibble: 3 x 9 +#> group_id row_id rowname date open high low close week +#> +#> 1 W05 min min NA 2002. 2023. 1989. 1995. NA +#> 2 W05 max max NA 2050. 2058. 2041. 2057. NA +#> 3 W05 avg avg NA 2030. 2039. 2009. 2021. NA }\if{html}{\out{}} Use the summary list to make a new \strong{gt} table. The key thing is to use diff --git a/man/fmt_country.Rd b/man/fmt_country.Rd index 52da5da940..ccd939334e 100644 --- a/man/fmt_country.Rd +++ b/man/fmt_country.Rd @@ -199,6 +199,26 @@ with names across 574 locales: \code{"AD"}, \code{"AE"}, \code{"AF"}, \code{"AG" \section{Examples}{ +The \code{\link{peeps}} dataset will be used to generate a small \strong{gt} table +containing only the people born in the 1980s. The \code{country} column contains +3-letter country codes and those will be transformed to country names with +\code{fmt_country()}. + +\if{html}{\out{
}}\preformatted{peeps |> + dplyr::filter(grepl("198", dob)) |> + dplyr::select(name_given, name_family, country, dob) |> + dplyr::arrange(country, name_family) |> + gt() |> + fmt_country(columns = country) |> + cols_merge(columns = c(name_given, name_family)) |> + opt_vertical_padding(scale = 0.5) |> + tab_options(column_labels.hidden = TRUE) +}\if{html}{\out{
}} + +\if{html}{\out{ +This image of a table was generated from the first code example in the `fmt_country()` help file. +}} + Use the \code{\link{countrypops}} dataset to create a \strong{gt} table. We will only include a few columns and rows from that table. The \code{country_code_3} column has 3-letter country codes in the format required for \code{fmt_country()} and @@ -222,7 +242,7 @@ using that function transforms the codes to country names. }\if{html}{\out{}} \if{html}{\out{ -This image of a table was generated from the first code example in the `fmt_country()` help file. +This image of a table was generated from the second code example in the `fmt_country()` help file. }} The country names derived from country codes can be localized. Let's @@ -265,7 +285,7 @@ different \code{locale} values in separate calls of \code{fmt_country()}. }\if{html}{\out{}} \if{html}{\out{ -This image of a table was generated from the second code example in the `fmt_country()` help file. +This image of a table was generated from the third code example in the `fmt_country()` help file. }} Let's make another \strong{gt} table, this time using the \code{\link{films}} dataset. The @@ -305,7 +325,7 @@ country codes like \code{"SU"} ('USSR'), \code{"CS"} ('Czechoslovakia'), and \co }\if{html}{\out{}} \if{html}{\out{ -This image of a table was generated from the third code example in the `fmt_country()` help file. +This image of a table was generated from the fourth code example in the `fmt_country()` help file. }} Country names can sometimes pair nicely with flag-based graphics. In this @@ -341,7 +361,7 @@ merged into the same cells as the icons via \code{\link[=cols_merge]{cols_merge( }\if{html}{\out{}} \if{html}{\out{ -This image of a table was generated from the fourth code example in the `fmt_country()` help file. +This image of a table was generated from the fifth code example in the `fmt_country()` help file. }} }