Package 'ojoutils'

Title: A Collection of Nifty Functions and Objects for OJO Analysts
Description: We find ourselves repeating the same simple tasks or running a series of R commands over and over again. No more!
Authors: Brancen Gregory [aut, cre], Andrew Bell [aut]
Maintainer: Brancen Gregory <[email protected]>
License: GPL (>= 3)
Version: 0.1.3
Built: 2024-11-22 02:50:09 UTC
Source: https://github.com/openjusticeok/ojoutils

Help Index


Directory Empty?

Description

Takes a path and determines whether it is empty.

Usage

dir_empty(path)

Arguments

path

A relative or absolute path to the directory to test.

Value

TRUE if the directory is empty, otherwise FALSE. If the directory doesn't exist, or the string supplied to path isn't recognized as a valid path, then the function returns an error.


Limit

Description

A thin wrapper around head to sooth the pain of context switching between R and SQL

Usage

limit(x, ...)

Arguments

x

The object to limit

...

Additional arguments to head

Details

A thin wrapper around head that allows limit to be used in place of head. This is useful because sometimes it is hard to context switch between R and SQL. It can be used on lazy data frames since this package imports dbplyr.

Value

The limited object


Oklahoma Counties

Description

Oklahoma Counties

Usage

ojo_counties

Format

An object of class character of length 77.


Parse Oklahoma Counties

Description

Parse Oklahoma Counties

Usage

ojo_parse_county(
  county,
  ...,
  case = "lower",
  squish = NULL,
  suffix = NULL,
  counties = ojo_counties,
  .silent = FALSE
)

Arguments

county

A string or character vector that represents an Oklahoma county

...

Placeholder for future arguments

case

The case to format the county string to. One of "lower", "upper", or "title".

squish

A boolean indicator of whether to remove whitespace

suffix

Specification of a suffix to remove from each item in county. For example, " County, OK".

counties

A vector of valid county names to match on.

.silent

A currently unused argument.


Function to use the OJO quarto HTML template

Description

Wrapper for ⁠quarto use template⁠ command. Defaults to OJO html template.

Usage

ojo_use_template(path, template = "openjusticeok/ojo-report-template")

Arguments

path

The name of the directory where the template should be added. This should be a string representing an absolute path, or a path relative to the current working directory.

template

The name of the Quarto template to use. This should be a string in the format "username/repository". Default is "openjusticeok/ojo-report-template".

Value

This function does not return a value. If the user chooses not to proceed with the operation, the function exits silently.

Examples

## Not run: 
ojo_use_template(template = "openjusticeok/ojo-report-template", path = "my_directory")

## End(Not run)