install logo correctly
This commit is contained in:
+7
-3
@@ -2,16 +2,20 @@
|
||||
% Please edit documentation in R/logo.R
|
||||
\name{add_logo}
|
||||
\alias{add_logo}
|
||||
\title{Title}
|
||||
\title{Add a logo to a ggplot2 object}
|
||||
\usage{
|
||||
add_logo(plot, logo, margin_param = NULL)
|
||||
}
|
||||
\arguments{
|
||||
\item{margin_param}{}
|
||||
\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{
|
||||
|
||||
}
|
||||
\description{
|
||||
Title
|
||||
Add a logo to a ggplot2 object
|
||||
}
|
||||
|
||||
+22
-3
@@ -2,16 +2,35 @@
|
||||
% Please edit documentation in R/logo.R
|
||||
\name{add_logo_ga}
|
||||
\alias{add_logo_ga}
|
||||
\title{Title}
|
||||
\title{Add a logo to a ggplot2 object}
|
||||
\usage{
|
||||
add_logo_ga(plot_list, logo, nrow = 1, widths = NULL, margin_param = NULL)
|
||||
}
|
||||
\arguments{
|
||||
\item{margin_param}{}
|
||||
\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{
|
||||
|
||||
}
|
||||
\description{
|
||||
Title
|
||||
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()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/db.R
|
||||
\name{countCleanr}
|
||||
\alias{countCleanr}
|
||||
\title{Clean unreported data counts in UCR data}
|
||||
\usage{
|
||||
countCleanr(x)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{a column of data, if character, substitute and conver to numeric}
|
||||
}
|
||||
\value{
|
||||
a numeric column of data
|
||||
}
|
||||
\description{
|
||||
Clean unreported data counts in UCR data
|
||||
}
|
||||
@@ -0,0 +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{
|
||||
|
||||
}
|
||||
\description{
|
||||
Count the number of single period entries in a vector
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/db.R
|
||||
\name{countNA}
|
||||
\alias{countNA}
|
||||
\title{Count number of missing values in a vector}
|
||||
\usage{
|
||||
countNA(x)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{a vector of values}
|
||||
}
|
||||
\value{
|
||||
an integer equal to the number of NA entries in the vector
|
||||
}
|
||||
\description{
|
||||
Count number of missing values in a vector
|
||||
}
|
||||
\examples{
|
||||
countNA(letters) # = 0
|
||||
countNA(c(letters, NA)) # = 1
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/db.R
|
||||
\name{dbSafeNames}
|
||||
\alias{dbSafeNames}
|
||||
\title{Make names safe for inclusion in a database}
|
||||
\usage{
|
||||
dbSafeNames(names)
|
||||
}
|
||||
\arguments{
|
||||
\item{names}{a character vector of possible column or table names}
|
||||
}
|
||||
\value{
|
||||
a vector the same length as the input vector with clean names
|
||||
}
|
||||
\description{
|
||||
Make names safe for inclusion in a database
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/db.R
|
||||
\name{findDots}
|
||||
\alias{findDots}
|
||||
\title{Find columns in a dataframe that have values with a "."}
|
||||
\usage{
|
||||
findDots(data)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{a dataframe}
|
||||
}
|
||||
\value{
|
||||
the names of columns in the dataframe with one or more entries equal to "."
|
||||
}
|
||||
\description{
|
||||
Find columns in a dataframe that have values with a "."
|
||||
}
|
||||
+6
-3
@@ -2,16 +2,19 @@
|
||||
% Please edit documentation in R/logo.R
|
||||
\name{get_png}
|
||||
\alias{get_png}
|
||||
\title{Title}
|
||||
\title{Plot a PNG file as a rasterGrob for inclusion in ggplot2}
|
||||
\usage{
|
||||
get_png(filename)
|
||||
}
|
||||
\arguments{
|
||||
\item{filename}{}
|
||||
\item{filename}{a character with file path to a png file}
|
||||
}
|
||||
\value{
|
||||
|
||||
}
|
||||
\description{
|
||||
Title
|
||||
Plot a PNG file as a rasterGrob for inclusion in ggplot2
|
||||
}
|
||||
\examples{
|
||||
|
||||
}
|
||||
|
||||
+8
-4
@@ -2,16 +2,20 @@
|
||||
% Please edit documentation in R/logo.R
|
||||
\name{has_caption}
|
||||
\alias{has_caption}
|
||||
\title{Title}
|
||||
\title{Test whether a ggplot2 object has a caption}
|
||||
\usage{
|
||||
has_caption(gg)
|
||||
}
|
||||
\arguments{
|
||||
\item{gg}{}
|
||||
\item{gg}{a gg object from ggplot2}
|
||||
}
|
||||
\value{
|
||||
|
||||
a logical, TRUE if a caption exists and FALSE if it does not
|
||||
}
|
||||
\description{
|
||||
Title
|
||||
Test whether a ggplot2 object has a caption
|
||||
}
|
||||
\examples{
|
||||
p1 <- ggplot2::qplot(mpg, wt, data = mtcars)
|
||||
has_caption(p1) # FALSE
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
\name{hello}
|
||||
\alias{hello}
|
||||
\title{Hello, World!}
|
||||
\usage{
|
||||
hello()
|
||||
}
|
||||
\description{
|
||||
Prints 'Hello, world!'.
|
||||
}
|
||||
\examples{
|
||||
hello()
|
||||
}
|
||||
@@ -7,8 +7,13 @@
|
||||
make_logo_grob()
|
||||
}
|
||||
\value{
|
||||
|
||||
a gg object which contains the logo file stored as a Grob suitable for manipulating in
|
||||
grid
|
||||
}
|
||||
\description{
|
||||
Get a Civilytics Logo grob
|
||||
}
|
||||
\examples{
|
||||
logo <- make_logo_grob()
|
||||
class(logo) # gg
|
||||
}
|
||||
|
||||
@@ -2,16 +2,21 @@
|
||||
% Please edit documentation in R/logo.R
|
||||
\name{measure_caption}
|
||||
\alias{measure_caption}
|
||||
\title{Title}
|
||||
\title{Measure a ggplot2 object caption}
|
||||
\usage{
|
||||
measure_caption(gg)
|
||||
}
|
||||
\arguments{
|
||||
\item{gg}{}
|
||||
\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{
|
||||
Title
|
||||
Measure a ggplot2 object caption
|
||||
}
|
||||
\examples{
|
||||
p1 <- qplot(mpg, wt, data = mtcars)
|
||||
measure_caption(p1) # Should equal 1 since no caption is required
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/db.R
|
||||
\name{nvals}
|
||||
\alias{nvals}
|
||||
\title{Count the number of unique values in a vector}
|
||||
\usage{
|
||||
nvals(x)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{a vector of values}
|
||||
}
|
||||
\value{
|
||||
an integer equal to the number of unique values in a vector
|
||||
}
|
||||
\description{
|
||||
Count the number of unique values in a vector
|
||||
}
|
||||
\examples{
|
||||
nvals(letters) # = 26
|
||||
nvals(state.abb) # = 50
|
||||
}
|
||||
+11
-5
@@ -2,19 +2,25 @@
|
||||
% Please edit documentation in R/logo.R
|
||||
\name{plot_jpeg}
|
||||
\alias{plot_jpeg}
|
||||
\title{Title}
|
||||
\title{Plot a jpeg image as a raster}
|
||||
\usage{
|
||||
plot_jpeg(path, add = FALSE, upscale = TRUE)
|
||||
}
|
||||
\arguments{
|
||||
\item{upscale}{}
|
||||
\item{path}{a character representing the relative or absolute path to the image}
|
||||
|
||||
\item{add}{a logical, TRUE to add the image to an existing plot, FALSE creates a new plot}
|
||||
|
||||
\item{upscale}{a logical, TRUE upscales the resolution of the graphic by a factor of 3, FALSE
|
||||
preserves the resolution}
|
||||
}
|
||||
\value{
|
||||
|
||||
a rasterImage
|
||||
}
|
||||
\description{
|
||||
Title
|
||||
Plot a jpeg image as a raster
|
||||
}
|
||||
\examples{
|
||||
img <- readJPEG(system.file("img","Rlogo.jpg",package="jpeg"))
|
||||
img <- system.file("img","Civilytics Consulting Logo.jpg",package="civilytics")
|
||||
plot_jpeg(img)
|
||||
}
|
||||
|
||||
+3
-2
@@ -10,10 +10,11 @@ pretty_per(x, ndigit = 1)
|
||||
\arguments{
|
||||
\item{x}{a numeric vector of proportions to convert to percentages}
|
||||
|
||||
\item{ndigit}{a vector of length 1 indicating the number of digits to display in the percent}
|
||||
\item{ndigit}{a vector of length 1 indicating the number of digits to display in the percent, by
|
||||
default it represents the digits after the decimal point in the percentage form}
|
||||
}
|
||||
\value{
|
||||
|
||||
a character vector with a % attached
|
||||
}
|
||||
\description{
|
||||
Prettify proportion data
|
||||
|
||||
+1
-1
@@ -19,5 +19,5 @@ Take the max but ignore missing values
|
||||
}
|
||||
\examples{
|
||||
safe_max(1:10)
|
||||
safe_max(c(1:10, NA)) # 10
|
||||
safe_max(c(1:10, NA))# 10
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/db.R
|
||||
\name{simpleCap}
|
||||
\alias{simpleCap}
|
||||
\title{Capitalize a character string after each space}
|
||||
\usage{
|
||||
simpleCap(x)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{a character string}
|
||||
}
|
||||
\value{
|
||||
a vector of characters with all values after a space capitalized
|
||||
}
|
||||
\description{
|
||||
Capitalize a character string after each space
|
||||
}
|
||||
\examples{
|
||||
my_string <- c("Happy school", "Easy school", "cool School", "big school")
|
||||
simpleCap(my_string)
|
||||
}
|
||||
+14
-4
@@ -2,7 +2,7 @@
|
||||
% Please edit documentation in R/theme.R
|
||||
\name{theme_civilytics}
|
||||
\alias{theme_civilytics}
|
||||
\title{Title}
|
||||
\title{Make the Civilytics plot theme}
|
||||
\usage{
|
||||
theme_civilytics(
|
||||
font_size = 14,
|
||||
@@ -14,11 +14,21 @@ theme_civilytics(
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{rel_large}{}
|
||||
\item{font_size}{default 14, a number representing the base font for the theme}
|
||||
|
||||
\item{font_family}{default "", a character for the font family to use in the theme}
|
||||
|
||||
\item{line_size}{default 0.5, the line size to use for the theme}
|
||||
|
||||
\item{rel_small}{default 12/14, the scale factor to create a small font from the base font_size}
|
||||
|
||||
\item{rel_tiny}{default 11/14, the scale factor to create a tiny font from the base font_size}
|
||||
|
||||
\item{rel_large}{default 16/14, the scale factor to create a large font from the base font_size}
|
||||
}
|
||||
\value{
|
||||
|
||||
a ggplot2 theme object suitable for combining with ggplot objects to theme them
|
||||
}
|
||||
\description{
|
||||
Title
|
||||
Make the Civilytics plot theme
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user