Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Please see the attached files and if you have any further questions please do ask?

1 answer below »
Please see the attached files and if you have any further questions please do ask?
Answered Same Day Sep 22, 2021

Solution

Subhanbasha answered on Sep 24 2021
137 Votes
---
title: "SIT741_Assignment 2"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
### Task 1:Source weather data
```{r}
# You need to run below which is calling the packages lines in every time
li
ary(magrittr)
li
ary(dplyr)
li
ary(tidyverse)
li
ary(tidyr)
li
ary(fitdistrplus)
li
ary(scales)
li
ary(rnoaa) # For doing NOAA API
li
ary(ISLR)
li
ary(skimr)
li
ary(mgcv) #GAM Package
li
ary(gamair)
li
ary(lu
idate)# package for to deal with times and dates
li
ary(
oom)
```
```{r}
options(noaakey = "vlkCHTlbHxaMelPjFsikwjEjYqnXdHQT") #Token
Perth_data <- ncdc(
datasetid = 'GHCND',
stationid = 'GHCND:ASN00009021',
startdate = '2013-07-01',
enddate = '2014-06-30',
limit = 1000
)$data
```
```{r}
data<-nrow(Perth_data)
sprintf("Rows in the dataset %s",data)
```
### Task 3:Modeling the ED demands
```{r}
ed_data <- 'govhack3.csv'
top_row <- read_csv(ed_data, col_names = FALSE, n_max = 1)
second_row <- read_csv(ed_data, n_max = 1)
column_names <- second_row %>%
unlist(., use.names=FALSE) %>%
make.unique(., sep = "__") # double underscore
column_names[2:8] <- str_c(column_names[2:8], '0', sep='__')
daily_attendance <- read_csv(ed_data, skip = 2, col_names = column_names)
daily_attendance
hospital_name<-top_row[colSums(!is.na(top_row)) > 0]
```
```{r}
daily_attendance$Date <- dmy(daily_attendance$Date)
daily_attendance <- transform(daily_attendance, ndate = as.numeric(Date),
nyear = as.numeric(format(Date, '%Y')),
nmonth = as.numeric(format(Date, '%m')),
day = as.numeric(format(Date, '%j')))
str(daily_attendance)
```
####Task 3.1: Models for a single facility
1.Picking a hospital
```{r}
sprintf("Royal Perth Hospital")
```
2.Linear Model
#####Linear Model
```{r}
lmfit_royal <- lm(Attendance__0~day ,
data = daily_attendance) # Linear Model
lmfit_royal
```
```{r}
lmfit_royal %>%
summary #Summary
```
```{r}
#jpeg('plot1.jpeg')
plot(lmfit_royal) #Plotting a...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here