-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
113 lines (83 loc) · 4.69 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
110
111
112
113
---
output: github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
# Source: https://stackoverflow.com/questions/34983822/how-to-have-r-formattable-rendered-to-pdf-output-and-how-to-have-percents-in-the
export_formattable <- function(f, file, width = "100%", height = NULL,
background = "white", delay = 0.2)
{
w <- as.htmlwidget(f, width = width, height = height)
path <- htmltools::html_print(w, background = background, viewer = NULL)
url <- paste0("file:///", gsub("\\\\", "/", normalizePath(path)))
webshot::webshot(url,
file = file,
selector = ".formattable_widget",
delay = delay)
}
```
# About `melig`
The R package `melig` contains information on **M**edicaid income **elig**ibility limits, collected by [the Kaiser Family Foundation](http://kff.org/data-collection/trends-in-medicaid-income-eligibility-limits/). It includes the following datasets:
- `children.rda`:
- [Medicaid Income Eligibility Limits for Infants Ages 0–1, 2000–2023](https://www.kff.org/medicaid/state-indicator/medicaid-income-eligibility-limits-for-infants-ages-0-1/)
- [Medicaid Income Eligibility Limits for Children Ages 1–5, 2000–2023](https://www.kff.org/medicaid/state-indicator/medicaid-income-eligibility-limits-for-children-ages-1-5/)
- [Medicaid Income Eligibility Limits for Children Ages 6–18, 2000–2023](https://www.kff.org/medicaid/state-indicator/medicaid-income-eligibility-limits-for-children-ages-6-18/)
- [Separate Children’s Health Insurance Program (CHIP) Income Eligibility Limits for Children, 2000–2023](https://www.kff.org/medicaid/state-indicator/separate-childrens-health-insurance-program-chip-income-eligibility-limits-for-children/)
- [Medicaid/CHIP Upper Income Eligibility Limits for Children, 2000–2023](https://www.kff.org/medicaid/state-indicator/medicaidchip-upper-income-eligibility-limits-for-children/)
- `prenant_wom.rda`: [Medicaid and CHIP Income Eligibility Limits for Pregnant Women, 2003–2023](https://www.kff.org/medicaid/state-indicator/medicaid-and-chip-income-eligibility-limits-for-pregnant-women/)
- `parents.rda`: [Medicaid Income Eligibility Limits for Parents, 2002–2023](https://www.kff.org/medicaid/state-indicator/medicaid-income-eligibility-limits-for-parents/)
- `childless_adults.rda`: [Medicaid Income Eligibility Limits for Other Non-Disabled Adults, 2011–2023](https://www.kff.org/medicaid/state-indicator/medicaid-income-eligibility-limits-for-other-non-disabled-adults/)
The datasets are stored in long format.
The [`/data-raw/`](https://github.com/jjchern/melig/tree/master/data-raw) folder contains raw data and R scripts.
# Installing the Package
You can install `melig` from Github with:
```R
# install.packages("remotes")
# Install the development version
remotes::install_github("jjchern/melig")
# Install the released version
remotes::install_github("jjchern/melig@v0.1.0")
# To uninstall the package, use:
# remove.packages("melig")
```
# Useful Links
- [Medicaid Income Eligibility Limits (Most Recent Data)](http://kff.org/state-category/medicaid-chip/medicaidchip-eligibility-limits/)
- [Annual Updates on Eligibility Rules, Enrollment and Renewal Procedures, and Cost-Sharing Practices in Medicaid and CHIP](http://kff.org/medicaid/report/annual-updates-on-eligibility-rules-enrollment-and/)
# Usage
## Long and Wide Formats
```{r, message=FALSE, warning=FALSE}
library(tidyverse)
library(formattable)
# List all available datasets
data(package = "melig") %>%
pluck("results") %>%
as_tibble() %>%
select(Package, Item)
# The datasets are in long format
melig::parents
# But you can always convert them back to the original wide format
melig::parents %>%
unite_("monyear", c("month", "year"), sep = " ") %>%
spread(monyear, cutoff)
```
## Save as Other Data Formats
```r
# save as Stata format
haven::write_dta(melig::parents, "pa0218.dta")
# or
rio::export(melig::parents, "pa0218.dta")
```
Or download the `*.rda` file and try the [rioweb](https://lbraglia.shinyapps.io/rioweb) made by @[lbraglia](https://github.com/lbraglia).
## Explore the Vignette
For a more detailed exploration of the Medicaid income eligibility cutoffs data, check out the [vignette](https://jjchern.github.io/melig/articles/medicaid-income-eligibility-cutoffs-overview.html). To access the vignette within R, after installing the package, you can view the vignette using the following command in your R console:
```r
vignette("medicaid-income-eligibility-cutoffs-overview")
```