Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructuring of repo #36

Merged
merged 10 commits into from
Feb 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,4 @@ ENV/
# Mac OS files
.DS_Store
.Rproj.user

10 changes: 10 additions & 0 deletions R/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## R

All R scripts and notebooks are here! Organizational structure:

- `analysis-vis`: Analyses and visualizations
- `apps`: Shiny app files (subfolder for each)
- `d4ddrugspending`: Anything that could be put in an R package - for example, functions to join specific datasets in our project
- `datawrangling`: Dataset-specific scripts to collect and clean

Note that data.world has an [R client](https://github.com/datadotworld/data.world-r)! This makes it easy to import data directly from our repo there.
5 changes: 5 additions & 0 deletions R/analysis-vis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## analysis-vis

Analysis and visualization scripts/Rmd files.

Note that data.world has a [R client](https://github.com/datadotworld/data.world-r)! Great for importing datasets directly from our repo there.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ library(jsonlite)

```{r load_spending_data}
## -- Spending data --------------------------------------------------------------------------------
## Read in drug names (brand + generic)
drugnames <- read_feather('data/drugnames.feather')

## Function to add a column with spending year to a data frame
add_drug_year <- function(df, yr){
mutate(df, drug_year = yr)
Expand All @@ -27,9 +24,8 @@ add_drug_year <- function(df, yr){
drug.years <- 2011:2015

## Read in each year's data set, add year and drug names, and combine into a single data.frame
spending.data <- map(paste0('data/spending-', drug.years, '.feather'), read_feather) %>%
spending.data <- map(paste0('dataworld/spending-', drug.years, '.feather'), read_feather) %>%
map2(drug.years, add_drug_year) %>%
map(bind_cols, drugnames) %>%
bind_rows()

```
Expand All @@ -39,6 +35,24 @@ head(spending.data)

```

```{r load_atc}
atc.data <- read.csv('dataworld/atc-codes.csv')
head(atc.data)
```

```{r check_drug_uses}
matt.drug.uses <- read_feather('dataworld/drug_uses.feather')

matt.drug.uses

```

```{r dig}
length(intersect())

```


```{r combine_generics}
## -- Combine data by year for all brand names for the same generic --------------------------------
spending.data.bygeneric <- spending.data %>%
Expand Down Expand Up @@ -95,6 +109,18 @@ head(therapeutic.areas)

```

# Try to merge therapeutic classes with drug names
```{r join_class_names}
library(fuzzyjoin)

## Need to extract generic names from name column

# ## -- Separate generic and brand names in therapeutic.areas ----------------------------------------
# therapeutic.areas <- therapeutic.areas %>%
# separate(name, into = c('brand', 'generic'), sep = ' \\(', remove = FALSE, fill = )

```

# Out-of-pocket cost over time for low-income vs non-low-income users of aripiprazole (Aricept)
```{r plot_aripiprazole}
plotdata <- spending.data.bygeneric %>%
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions R/apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## apps

Scripts for R Shiny apps. Store each app in a separate subdirectory.

Note that data.world has a [R client](https://github.com/datadotworld/data.world-r)! Great for importing datasets directly from our repo there.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading