You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapters/05-01-hcup-amadeus-usecase.Rmd
+153-2Lines changed: 153 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,7 @@ The `fwf_positions()` function is utilizing column start and end positions found
123
123
df2 <- readr::read_fwf(
124
124
data_file,
125
125
readr::fwf_positions(start = df$X6, end = df$X7, col_names = df$X5),
126
-
skip = 20,
126
+
skip = 2,
127
127
na = missing_values
128
128
)
129
129
@@ -235,7 +235,7 @@ temp_covar <- calculate_hms(
235
235
)
236
236
237
237
# Save processed data
238
-
saveRDS(temp_covar, "smoke_plume2021_covar.R")
238
+
saveRDS(temp_covar, "smoke_plume_covar.R")
239
239
```
240
240
241
241
In preparation for the next section we are going to make two new dataframes from our `temp_covar` object. The first collapses our zipcodes taking the average of light, medium, or heavy days.
## Data Analysis using HCUP and Amadeus data sources
293
+
294
+
First we will load in our hcup data file we processed earlier and subset the file to a set of observations that make the data easier to work with (702 to 39 columns) and are still interesting for analysis. This includes zipcodes, age at admission, admission month, race identifier, sex, and ICD 10 diagnosis codes.
Next we will select July as our month of interest to further reduce the size of the data and to focus on a time frame where we know fires took place in Oregon. We will also load in our environmental data files we made above from amadeus.
Next, we will identify individuals diagnosed with asthma. This involves searching for the ICD-10 code "J45" within the diagnosis columns of our dataset.
349
+
350
+
```{r eval=FALSE}
351
+
# Identify the columns containing diagnosis codes (prefix "I10_")
352
+
diag_columns <- grep("^I10_", colnames(merged_data), value = TRUE)
353
+
354
+
# Create a new column `has_asthma` that checks if any diagnosis contains "J45"
0 commit comments