options(repos = c(CRAN = "https://cran.rstudio.com/"))
install.packages("readr")
## package 'readr' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'readr'
## Warning in file.copy(savedcopy, lib, recursive = TRUE): problem copying
## C:\Users\koltn\AppData\Local\Programs\R\R-4.4.2\library\00LOCK\readr\libs\x64\readr.dll
## to
## C:\Users\koltn\AppData\Local\Programs\R\R-4.4.2\library\readr\libs\x64\readr.dll:
## Permission denied
## Warning: restored 'readr'
##
## The downloaded binary packages are in
## C:\Users\koltn\AppData\Local\Temp\RtmpAZbDLb\downloaded_packages
install.packages("dplyr")
## package 'dplyr' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'dplyr'
## Warning in file.copy(savedcopy, lib, recursive = TRUE): problem copying
## C:\Users\koltn\AppData\Local\Programs\R\R-4.4.2\library\00LOCK\dplyr\libs\x64\dplyr.dll
## to
## C:\Users\koltn\AppData\Local\Programs\R\R-4.4.2\library\dplyr\libs\x64\dplyr.dll:
## Permission denied
## Warning: restored 'dplyr'
##
## The downloaded binary packages are in
## C:\Users\koltn\AppData\Local\Temp\RtmpAZbDLb\downloaded_packages
library(readr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
Week_2_HW1 <- read_csv("C:/Users/koltn/Desktop/Work/R Studio Class/W2HW1.csv")
## Rows: 51 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (7): Indicator, Year, Geography, Age Group, Race/Ethnicity, Sex, Transmi...
## dbl (2): FIPS, Percent
## num (2): Cases, Population
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Week_2_HW1_Cleaned <- Week_2_HW1 %>%
select(-c("Indicator", "Year", "FIPS", "Age Group", "Race/Ethnicity", "Sex", "Transmission Category"))
Week_2_HW1_rates <- Week_2_HW1_Cleaned %>%
mutate(Rate = (Cases / Population) * 100000)
print(Week_2_HW1_rates)
## # A tibble: 51 × 5
## Geography Cases Percent Population Rate
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Alabama 13992 84.4 16600 84289.
## 2 Alaska 721 84.9 850 84824.
## 3 Arizona 17472 84.3 20700 84406.
## 4 Arkansas 5948 79.8 7500 79307.
## 5 California 133497 87.3 152800 87367.
## 6 Colorado 13031 87.7 14900 87456.
## 7 Connecticut 10391 91.7 11300 91956.
## 8 Delaware 3381 87.5 3900 86692.
## 9 District of Columbia 13655 94 14500 94172.
## 10 Florida 113398 86.7 130900 86629.
## # ℹ 41 more rows