library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.1.2 v dplyr 1.0.6
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(hrbrthemes)
## NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
## Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
## if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
library(ggplot2)
library(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
BySex <- read.csv("C:/Users/IBM/Desktop/DVAssignment3/BySex-1.csv",fileEncoding="UTF-8-BOM")
ByAgeGroup <- read.csv("C:/Users/IBM/Desktop/DVAssignment3/ByAgeGroup-2.csv",fileEncoding="UTF-8-BOM")
QuaterNew <- read.csv("C:/Users/IBM/Desktop/DVAssignment3/QuaterNew-1.csv",fileEncoding="UTF-8-BOM")
Long_BySex<-BySex %>%
gather(`Male`, `Female`, key = "Sex" , value = "Number")
ggplot(data=Long_BySex, aes(x=year, y=Number, fill=Sex)) +
geom_bar(stat="identity" , position=position_dodge())+
scale_fill_viridis_d()
ggplot(data=ByAgeGroup, aes(x=year, y=Total, fill=Age_group)) +
geom_bar(stat="identity" , position=position_dodge())+
scale_fill_viridis_d()
### Family violence in Australia 2016 - 2020
QuaterNew$Year<-as.numeric(QuaterNew$Year)
QuaterNew$Month_1<-as.numeric(QuaterNew$Month)
QuaterNew$Day<-as.numeric(QuaterNew$Day)
QuaterNew$Date<-as.Date(with(QuaterNew,paste(Year,Month,Day,sep="-")),"%Y-%m-%d")
p <- ggplot(QuaterNew, aes(x=Date, y=Incident_Count)) +
geom_line( color="steelblue") +
geom_point() +
xlab("") +
theme_ipsum() +
theme(axis.text.x=element_text(angle=60, hjust=1)) +
scale_x_date(date_labels = "%b/%Y")+
ylim(5000,8000)
p