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 DaySep 22, 2021

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

Subhanbasha answered on Sep 24 2021
136 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 c
alling the packages lines in every time
library(magrittr)
library(dplyr)
library(tidyverse)
library(tidyr)
library(fitdistrplus)
library(scales)
library(rnoaa) # For doing NOAA API
library(ISLR)
library(skimr)
library(mgcv) #GAM Package
library(gamair)
library(lubridate)# package for to deal with times and dates
library(broom)
```
```{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