@@ -91,50 +91,27 @@ We will use a dataset from a project we worked on called Open Case Studies.
91
91
92
92
See https://www.opencasestudies.org/ .
93
93
94
- First we need to install and load the package .
94
+ We have added the specific data to our website .
95
95
96
- ``` {r, eval = FALSE}
97
- install.packages("OCSdata")
98
- ```
99
-
100
- ``` {r, echo = FALSE, message=FALSE, comment= FALSE, results='hide'}
101
- install.packages("OCSdata", repos='http://cran.us.r-project.org')
102
- ```
103
-
104
- ``` {r}
105
- library(OCSdata)
106
- ```
107
96
108
97
## Getting data to work with
109
98
110
- Then we will load data from one of the case studies about opioid shipments.
111
-
112
- See https://cran.r-project.org/web/packages/OCSdata/vignettes/instructions.html for more info on what data is available.
99
+ We will load data from one of the case studies about opioid shipments.
113
100
114
101
See https://www.opencasestudies.org/ocs-bp-opioid-rural-urban/ about this data.
115
102
116
103
117
104
## Import the data
118
105
119
- Now we will get the data from the ` OCSdata ` package using the ` load_imported_data() ` function.
120
-
121
- ``` {r}
122
- load_imported_data("ocs-bp-opioid-rural-urban")
123
- ```
106
+ We will work with data called ` annualDosage ` (number of shipments (count) of either oxycodone or hydrocodone pills (DOSAGE_UNIT)).
124
107
125
- You will see a few new objects in your environment called:
126
-
127
- - ` annualDosage ` (number of shipments (count) of either oxycodone or hydrocodone pills (DOSAGE_UNIT)) - * we will work with this one for now*
128
- - ` county_pop ` (population per county)
129
- - ` land ` (land area per county)
130
-
131
- ## Import the data - method 2
132
108
133
109
``` {r}
134
110
annualDosage <- read_csv("https://jhudatascience.org/intro_to_r/data/annualDosage.csv")
135
111
136
112
```
137
113
114
+
138
115
## Checking the data ` dim() `
139
116
140
117
The ` dim() ` , ` nrow() ` , and ` ncol() ` functions are good options to check the dimensions of your data before moving forward.
@@ -419,9 +396,7 @@ clean_names(test)
419
396
This time lets also make it a smaller subset so it is easier for us to see the full dataset as we work through examples.
420
397
421
398
``` {r}
422
- #install.packages(OCSdata)
423
- #library(OCSdata)
424
- #OCSdata::load_imported_data("ocs-bp-opioid-rural-urban")
399
+ #read_csv("https://jhudatascience.org/intro_to_r/data/annualDosage.csv")
425
400
set.seed(1234)
426
401
AD <-slice_sample(annualDosage, n = 30)
427
402
```
@@ -681,9 +656,7 @@ https://media.giphy.com/media/5b5OU7aUekfdSAER5I/giphy.gif
681
656
## Get the data
682
657
683
658
``` {r}
684
- #install.packages(OCSdata)
685
- #library(OCSdata)
686
- #OCSdata::load_imported_data("ocs-bp-opioid-rural-urban")
659
+ #read_csv("https://jhudatascience.org/intro_to_r/data/annualDosage.csv")
687
660
set.seed(1234)
688
661
AD <-slice_sample(annualDosage, n = 30)
689
662
```
0 commit comments