fix proportion ci calc and theme
Gitea Organization/civilyticsR/pipeline/head There was a failure building this commit

This commit is contained in:
2024-08-09 15:05:59 -04:00
parent 4f49ae6d5a
commit 82b8db7f84
18 changed files with 481 additions and 436 deletions
+21 -21
View File
@@ -1,21 +1,21 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logo.R
\name{add_logo}
\alias{add_logo}
\title{Add a logo to a ggplot2 object}
\usage{
add_logo(plot, logo, margin_param = NULL)
}
\arguments{
\item{plot}{a ggplot2 grob}
\item{logo}{a logo grob created by make_logo_grob()}
\item{margin_param}{a numeric specifying what margin to add or subtract to align the logo}
}
\value{
a grob with a logo attached to it ready to plot
}
\description{
Add a logo to a ggplot2 object
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logo.R
\name{add_logo}
\alias{add_logo}
\title{Add a logo to a ggplot2 object}
\usage{
add_logo(plot, logo, margin_param = NULL)
}
\arguments{
\item{plot}{a ggplot2 grob}
\item{logo}{a logo grob created by make_logo_grob()}
\item{margin_param}{a numeric specifying what margin to add or subtract to align the logo}
}
\value{
a grob with a logo attached to it ready to plot
}
\description{
Add a logo to a ggplot2 object
}
+36 -36
View File
@@ -1,36 +1,36 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logo.R
\name{add_logo_ga}
\alias{add_logo_ga}
\title{Add a logo to a ggplot2 object}
\usage{
add_logo_ga(plot_list, logo, nrow = 1, widths = NULL, margin_param = NULL)
}
\arguments{
\item{plot_list}{a list containing ggplot2 objects}
\item{logo}{a grob containing the logo created with `make_logo_grob`}
\item{nrow}{an integer, default = 1, for the number of rows to align the plots in}
\item{widths}{an optional vector the same length as plot_list with the widths for each plot}
\item{margin_param}{a number giving the adjustment up or down to help manually align logo and captions}
}
\value{
a grid object
}
\description{
Add a logo to a ggplot2 object
}
\note{
The resulting object needs to be drawn to the screen using grid.draw()
}
\examples{
library(ggplot2); library(grid)
tmp_plot <- ggplot(mtcars) + aes(x = hp, y = disp) + geom_point() + theme_civilytics()
tmp_logo <- make_logo_grob()
plot_and_logo <- add_logo(tmp_plot, tmp_logo)
grid.draw(plot_and_logo)
dev.off()
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logo.R
\name{add_logo_ga}
\alias{add_logo_ga}
\title{Add a logo to a ggplot2 object}
\usage{
add_logo_ga(plot_list, logo, nrow = 1, widths = NULL, margin_param = NULL)
}
\arguments{
\item{plot_list}{a list containing ggplot2 objects}
\item{logo}{a grob containing the logo created with `make_logo_grob`}
\item{nrow}{an integer, default = 1, for the number of rows to align the plots in}
\item{widths}{an optional vector the same length as plot_list with the widths for each plot}
\item{margin_param}{a number giving the adjustment up or down to help manually align logo and captions}
}
\value{
a grid object
}
\description{
Add a logo to a ggplot2 object
}
\note{
The resulting object needs to be drawn to the screen using grid.draw()
}
\examples{
library(ggplot2); library(grid)
tmp_plot <- ggplot(mtcars) + aes(x = hp, y = disp) + geom_point() + theme_civilytics()
tmp_logo <- make_logo_grob()
plot_and_logo <- add_logo(tmp_plot, tmp_logo)
grid.draw(plot_and_logo)
dev.off()
}
+17 -17
View File
@@ -1,17 +1,17 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/db.R
\name{countDots}
\alias{countDots}
\title{Count the number of single period entries in a vector}
\usage{
countDots(x)
}
\arguments{
\item{x}{a character vector}
}
\value{
An integer counting the number of "." occurences in a vector
}
\description{
Count the number of single period entries in a vector
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/db.R
\name{countDots}
\alias{countDots}
\title{Count the number of single period entries in a vector}
\usage{
countDots(x)
}
\arguments{
\item{x}{a character vector}
}
\value{
An integer counting the number of "." occurences in a vector
}
\description{
Count the number of single period entries in a vector
}
+17 -17
View File
@@ -1,17 +1,17 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logo.R
\name{get_png}
\alias{get_png}
\title{Plot a PNG file as a rasterGrob for inclusion in ggplot2}
\usage{
get_png(filename)
}
\arguments{
\item{filename}{a character with file path to a png file}
}
\value{
a plotted rasteGrob of a png image
}
\description{
Plot a PNG file as a rasterGrob for inclusion in ggplot2
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logo.R
\name{get_png}
\alias{get_png}
\title{Plot a PNG file as a rasterGrob for inclusion in ggplot2}
\usage{
get_png(filename)
}
\arguments{
\item{filename}{a character with file path to a png file}
}
\value{
a plotted rasteGrob of a png image
}
\description{
Plot a PNG file as a rasterGrob for inclusion in ggplot2
}
+20 -20
View File
@@ -1,20 +1,20 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{grade_level_to_num}
\alias{grade_level_to_num}
\title{Recode grade level from character to numeric}
\usage{
grade_level_to_num(x)
}
\arguments{
\item{x}{character description of grade levels from NCES style data}
}
\value{
a numeric vector
}
\description{
Recode grade level from character to numeric
}
\examples{
grade_level_to_num(c("KG", "Pre-K", "12", "10", "09"))
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{grade_level_to_num}
\alias{grade_level_to_num}
\title{Recode grade level from character to numeric}
\usage{
grade_level_to_num(x)
}
\arguments{
\item{x}{character description of grade levels from NCES style data}
}
\value{
a numeric vector
}
\description{
Recode grade level from character to numeric
}
\examples{
grade_level_to_num(c("KG", "Pre-K", "12", "10", "09"))
}
+22 -22
View File
@@ -1,22 +1,22 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logo.R
\name{measure_caption}
\alias{measure_caption}
\title{Measure a ggplot2 object caption}
\usage{
measure_caption(gg)
}
\arguments{
\item{gg}{a ggplot object}
}
\value{
a numeric value stating the number of lines to be added or subtracted to align a logo with
the caption
}
\description{
Measure a ggplot2 object caption
}
\examples{
p1 <- ggplot2::qplot(mpg, wt, data = mtcars)
measure_caption(p1) # Should equal 1 since no caption is required
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logo.R
\name{measure_caption}
\alias{measure_caption}
\title{Measure a ggplot2 object caption}
\usage{
measure_caption(gg)
}
\arguments{
\item{gg}{a ggplot object}
}
\value{
a numeric value stating the number of lines to be added or subtracted to align a logo with
the caption
}
\description{
Measure a ggplot2 object caption
}
\examples{
p1 <- ggplot2::qplot(mpg, wt, data = mtcars)
measure_caption(p1) # Should equal 1 since no caption is required
}
+20 -20
View File
@@ -1,20 +1,20 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{race_short_names}
\alias{race_short_names}
\title{Recode NCES race categories to shorter names}
\usage{
race_short_names(x)
}
\arguments{
\item{x}{a character vector with NCES race codes, often from Urban Institute}
}
\value{
recoded race categories following NCES race codes
}
\description{
Recode NCES race categories to shorter names
}
\examples{
race_short_names(c("Black", "Hispanic Or Latino", "Two Or More Races"))
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{race_short_names}
\alias{race_short_names}
\title{Recode NCES race categories to shorter names}
\usage{
race_short_names(x)
}
\arguments{
\item{x}{a character vector with NCES race codes, often from Urban Institute}
}
\value{
recoded race categories following NCES race codes
}
\description{
Recode NCES race categories to shorter names
}
\examples{
race_short_names(c("Black", "Hispanic Or Latino", "Two Or More Races"))
}
+28 -28
View File
@@ -1,28 +1,28 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{star_subs}
\alias{star_subs}
\title{Unsuppress data using sampling}
\usage{
star_subs(x, replace_char = "*", zeros = 15, max_value = 20)
}
\arguments{
\item{x}{a vector}
\item{replace_char}{the character you want to replace in the vector}
\item{zeros}{the number of zeroes to oversample when replacing replace_char}
\item{max_value}{the numeric maximum value the replacement for the "*" can be}
}
\value{
a numeric vector with no characters representing suppressed values
}
\description{
Unsuppress data using sampling
}
\examples{
suppr_data <- c("2", "8", "*", "*", "7", "9", "100")
star_subs(suppr_data, zeros = 1, max_value = 10)
star_subs(suppr_data, zeros = 1, max_value = 200)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{star_subs}
\alias{star_subs}
\title{Unsuppress data using sampling}
\usage{
star_subs(x, replace_char = "*", zeros = 15, max_value = 20)
}
\arguments{
\item{x}{a vector}
\item{replace_char}{the character you want to replace in the vector}
\item{zeros}{the number of zeroes to oversample when replacing replace_char}
\item{max_value}{the numeric maximum value the replacement for the "*" can be}
}
\value{
a numeric vector with no characters representing suppressed values
}
\description{
Unsuppress data using sampling
}
\examples{
suppr_data <- c("2", "8", "*", "*", "7", "9", "100")
star_subs(suppr_data, zeros = 1, max_value = 10)
star_subs(suppr_data, zeros = 1, max_value = 200)
}