Warning: package 'ggplot2' was built under R version 4.3.3
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.0 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(lubridate)library(scales)
Attaching package: 'scales'
The following object is masked from 'package:purrr':
discard
The following object is masked from 'package:readr':
col_factor
library(tidycensus)
Warning: package 'tidycensus' was built under R version 4.3.3
library(sf)
Warning: package 'sf' was built under R version 4.3.3
Linking to GEOS 3.11.2, GDAL 3.8.2, PROJ 9.3.1; sf_use_s2() is TRUE
library(leaflet)
Warning: package 'leaflet' was built under R version 4.3.3
library(usdata)
Warning: package 'usdata' was built under R version 4.3.3
library(plotly)
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
states <-get_acs(geography ="state",variables ="B01003_001",geometry =TRUE,shift_geo = T)
Getting data from the 2018-2022 5-year ACS
Warning: The `shift_geo` argument is deprecated and will be removed in a future
release. We recommend using `tigris::shift_geometry()` instead.
Using feature geometry obtained from the albersusa package
Please note: Alaska and Hawaii are being shifted and are not to scale.
old-style crs object detected; please recreate object with a recent sf::st_crs()
suicide_rates <-read_csv("suicide_rates.csv")
Rows: 450 Columns: 5
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): STATE, URL
dbl (2): YEAR, RATE
num (1): DEATHS
ℹ 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.
Assuming "longitude" and "latitude" are longitude and latitude, respectively
The following table displays offenses as well as who/what they were against in the Austin area on July 4th, 2022.
july_4 |>count(offense_type, offense_against)
# A tibble: 26 × 3
offense_type offense_against n
<chr> <chr> <int>
1 aggravated assault persons 37
2 all other larceny property 24
3 all other offenses other 12
4 counterfeiting/forgery property 1
5 credit card/automated teller machine fraud property 1
6 destruction/damage/vandalism of property (except arson) property 17
7 disorderly conduct society 8
8 driving under the influence society 6
9 drug equipment violations society 1
10 drug/narcotic violations society 5
# ℹ 16 more rows