-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
109 lines (87 loc) · 3.71 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# CCAO <a href='https://github.com/ccao-data/ccao'><img src='man/figures/logo.png' align="right" height="139" /></a>
[![R-CMD-check](https://github.com/ccao-data/ccao/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ccao-data/ccao/actions/workflows/R-CMD-check.yaml)
[![test-coverage](https://github.com/ccao-data/ccao/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/ccao-data/ccao/actions/workflows/test-coverage.yaml)
[![lint](https://github.com/ccao-data/ccao/actions/workflows/lint.yaml/badge.svg)](https://github.com/ccao-data/ccao/actions/workflows/lint.yaml)
[![pre-commit](https://github.com/ccao-data/ccao/actions/workflows/pre-commit.yaml/badge.svg)](https://github.com/ccao-data/ccao/actions/workflows/pre-commit.yaml)
[![codecov](https://codecov.io/gh/ccao-data/ccao/branch/master/graph/badge.svg)](https://codecov.io/gh/ccao-data/ccao)
A package to manage, distribute, and version control *CCAO-specific* functions. These functions are used throughout CCAO applications, models, and diagnostics. For generalized versions of assessment-related functions, see [assessR](https://github.com/ccao-data/assessr).
For detailed documentation on included functions and data, [**visit the full reference list**](https://ccao-data.github.io/ccao/reference/index.html).
## Installation
You can install the released version of `ccao` directly from GitHub with one of the following commands:
```{r, eval=FALSE}
# Using remotes
remotes::install_github("ccao-data/ccao")
# Using renv
renv::install("ccao-data/ccao")
# Using pak
pak::pak("ccao-data/ccao")
# Append the @ symbol for a specific version
remotes::install_github("ccao-data/[email protected]")
```
## Basic usage
Here is a quick example using `ccao` functions with included sample data:
```{r, message=FALSE, results='asis'}
library(ccao)
library(dplyr)
library(knitr)
# Create a small subsample of data. This is the "raw" data taken from SQL
sample_data <- chars_sample_athena %>%
select(pin, year, char_yrblt, char_gar1_size, char_ext_wall) %>%
slice(c(1, 2, 5, 14)) %>%
mutate(township_code = c("72", "73", "71", "72"))
sample_data %>%
kable(digits = 3)
# Recode/rename/clean data using town_ and vars_ functions from ccao
sample_data %>%
mutate(
pin = pin_format_pretty(pin),
township_name = town_convert(township_code),
triad_name = town_get_triad(township_code, name = TRUE),
`Next Reass. Year` = town_get_assmnt_year(
township_code,
round_type = "ceiling"
)
) %>%
vars_recode(type = "long") %>%
vars_rename(names_from = "athena", names_to = "pretty") %>%
kable(digits = 3)
```
## CCAO colors
The CCAO Communications Department created a palette of colors for CCAO press materials and visualizations. Navy, gold, and buttermilk are the colors used in the CCAO logo. Typically navy and gold are used for discrete values in plots. The hex codes for these colors are available via the named list `ccao_colors`.
```{r colors, echo=FALSE, fig.height=1, warning=FALSE}
library(ggplot2)
ggplot() +
geom_tile(aes(x = 1:12, y = 1), fill = ccao::ccao_colors) +
geom_text(
aes(
x = 1:12,
y = 1,
label = names(ccao::ccao_colors),
color = c(rep("1", 5), "2", rep("1", 5), "2")
),
angle = 90,
vjust = 0.3
) +
scale_color_manual(
guide = "none",
values = c("1" = "black", "2" = "white")
) +
scale_x_discrete(expand = c(0, 0)) +
scale_y_discrete(expand = c(0, 0)) +
theme_minimal() +
theme(
axis.title = element_blank()
)
```