-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgovernance.Rmd
66 lines (46 loc) · 1.54 KB
/
governance.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
---
title: "Getting Started"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{governance}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup, message=FALSE, warning=F}
library(governance)
library(dplyr)
library(data.table)
```
## Step 1: Get Input Data
We assume the user already has the relevant 990 Efile data downloaded. Instructions for downloading the need 990 efile data, see \code{vignette("download-data", package = "goveranance")}.
We will use a subset of a test set that was already created. See `data-raw/01-get-example-data.R`[here](https://github.com/Nonprofit-Open-Data-Collective/governance/blob/main/data-raw/01-get-example-data.R) for details on how this data set was created.
```{r}
data("dat_example", package = "governance")
set.seed(57)
keep_rows <- sample(1:nrow(dat_example), 200)
dat_example <- dat_example[keep_rows, ]
```
## Step 2: Get Features Matrix
Use the `get_features()` function to clean the data and transform it into a features matrix.
```{r}
features_example <- get_features(dat_example)
head(features_example) %>% data.table()
```
## Step 3: Calculate the Scores
Use the `get_scores()` function to get the governance scores.
```{r}
scores_example <- get_scores(features_example)
head(scores_example) %>% data.table()
```
We can explore our governance scores.
```{r}
hist(scores_example$total.score,
main = "Histogram of Goverance Scores",
xlab = "Total Score")
```