Title: | Creates New Folders and Loads Standard Practices for Monterey County Office of Education |
---|---|
Description: | Basic Setup for Projects in R for Monterey County Office of Education. It contains functions often used in the analysis of education data in the county office including seeing if an item is not in a list, rounding in the manner the general public expects, including logos for districts, switching between district names and their county-district-school codes, accessing the local 'SQL' table and making thematically consistent graphs. |
Authors: | David Dobrowski [aut, cre, cph] |
Maintainer: | David Dobrowski <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.0 |
Built: | 2024-11-03 04:36:28 UTC |
Source: | https://github.com/dobrowski/mcoe |
MCOE The inverse of _in_ where the list is excluded
x %notin% table
x %notin% table
x |
Item or list to look at |
table |
List to make sure it is not part of |
'
fruit <- c("apple", "banana", "pear", "pineapple") "kiwi" %notin% fruit
fruit <- c("apple", "banana", "pear", "pineapple") "kiwi" %notin% fruit
When using the MCOE 'SQL' tables, it will merge codebook descriptions from CDE
left_join_codebook(df, tablename, field)
left_join_codebook(df, tablename, field)
df |
local dataframe you want to append labels to |
tablename |
which 'SQL' table is the data from |
field |
which field in the table do you want the labels for |
An 'tibble' of the same type as '.data'. The output has an one column names 'definition' which contains labels for the passed argument 'field'.
try( sbac.filtered <- tbl(con, "CAASPP") |> head(100) |> collect() |> left_join_codebook("CAASPP", "Subgroup_ID") )
try( sbac.filtered <- tbl(con, "CAASPP") |> head(100) |> collect() |> left_join_codebook("CAASPP", "Subgroup_ID") )
Graphing function to make lollipop bar graphs
lollipop(df, y_var, x_var, colorme)
lollipop(df, y_var, x_var, colorme)
df |
dataframe source to graph |
y_var |
variable for Y |
x_var |
variable for X |
colorme |
color to make the bars |
a 'ggplot' class graph with horiztontal bars with circles at the end of the bars
library(dplyr) df.example <- dplyr::tribble(~name, ~rate, "Nina",32,"David",65) lollipop(df = df.example, x_var = name, y_var = rate, colorme = "pink" )
library(dplyr) df.example <- dplyr::tribble(~name, ~rate, "Nina",32,"David",65) lollipop(df = df.example, x_var = name, y_var = rate, colorme = "pink" )
Given a CDS code, adds the district logo
mcoe_d_logo(cds.number)
mcoe_d_logo(cds.number)
cds.number |
County-District-School code from California Department of Education |
'mcoe_d_logo' an object of class 'magick-image' from [magick::image_read()] which is an image file of the district logo
try(mcoe_d_logo("27659870000000"))
try(mcoe_d_logo("27659870000000"))
Adds the MCOE logo
mcoe_logo()
mcoe_logo()
'mcoe_logo' an object of class 'magick-image' from [magick::image_read()] which is an image file of the MCOE logo
mcoe_logo()
mcoe_logo()
Given a CDS code it provides the logo
mcoe_logo_location(cds.number)
mcoe_logo_location(cds.number)
cds.number |
County-District-School code from California Department of Education |
'mcoe_logo_location' returns a 'string' containing a file location the district logo
mcoe_logo_location("27659870000000")
mcoe_logo_location("27659870000000")
Given a CDS code, it gives the name of the district
mcoe_name(cds.number)
mcoe_name(cds.number)
cds.number |
County-District-School code from California Department of Education |
a 'string' of the district name
mcoe_name("27661590000000")
mcoe_name("27661590000000")
Connects to the MCOE 'SQL' tables
mcoe_sql_con()
mcoe_sql_con()
a database connection in the form of [DBI::dbConnect]
try(mcoe_sql_con())
try(mcoe_sql_con())
Modifies ggplots to use a common theme
mcoe_theme
mcoe_theme
An object of class list
of length 4.
a 'list' of [ggplot] elements to add to a graph
library(dplyr) df.example <- dplyr::tribble(~name, ~rate, "Nina",32,"David",65) g <- ggplot2::ggplot(df.example, ggplot2::aes(name, rate)) + ggplot2::geom_col() g + mcoe_theme
library(dplyr) df.example <- dplyr::tribble(~name, ~rate, "Nina",32,"David",65) g <- ggplot2::ggplot(df.example, ggplot2::aes(name, rate)) + ggplot2::geom_col() g + mcoe_theme
A subset of data from California Department of Education identifying schools
mry.dist
mry.dist
## 'mry.dist' A data frame with 256 rows and 50 columns:
District name
School name
County, District, School code
...
<https://www.cde.ca.gov/ds/si/ds/pubschls.asp>
Rounding the way most people do it with .5 roudning up
round2(x, digits = 2)
round2(x, digits = 2)
x |
number to be rounded |
digits |
how many digits to round to |
'round2' returns a truncated 'numeric' with decimal places equal to 'digits' argument
x <- 1.2345 round2(x, digits = 2)
x <- 1.2345 round2(x, digits = 2)