You will use R to analyse data collected that contains information on the Means of Travel, Time and Distance to Work, School or College. You will be assigned a county for the purposes of answering the...

1 answer below »

View more »
Answered Same DayNov 18, 2021

Answer To: You will use R to analyse data collected that contains information on the Means of Travel, Time and...

Pritam answered on Nov 21 2021
157 Votes
data = read.csv("transport.csv", header = T)
str(data)
# missing values:
tb = colMeans(is.na(data))
which(tb >= 0.3)
sum(is.na(data))
colSums(is.na(data))
# So, there are onl two missing value in the overall data and all of the variables
# have less than 1% missing values. So, no need to worry about the missing values
# Q
uestion 1:
t1 = sapply(data[,c(10:22)], sum)
which.max(t1)
# As it seems that private transport comb is the most popular transport mode in the
# contry.
library(dplyr)
library(stringr)
# Question 2:
d2 = filter(data, County == "Carlow")
t2 = sapply(d2[,c(10:22)], sum)
which.max(t2)
# The same transport seems to be the most popular in the county of Carlow also.
d3 = data[,c(6,10:22)]
library(ggplot2)
g1 = ggplot(d3, aes(County,
Population_Aged_5_Over_By_Means_Of_Travel_To_Work_School_College_On_Foot_2011))+
geom_boxplot()
g1+coord_flip()
g2 = ggplot(d3, aes(County,
d3$Population_Aged_5_Over_By_Means_Of_Travel_To_Work_School_College_Bicycle_2011))+
geom_boxplot()
g2+coord_flip()
g3 = ggplot(d3, aes(County,
d3$Population_Aged_5_Over_By_Means_Of_Travel_To_Work_School_College_Bus_Minibus_Coach_2011 ))+
geom_boxplot()
g3+coord_flip()
g4 = ggplot(d3, aes(County,
d3$Population_Aged_5_Over_By_Means_Of_Travel_To_Work_School_College_Train_Dart_Luas_2011))+
geom_boxplot()
g4+coord_flip()
g5 = ggplot(d3, aes(County,
d3$Population_Aged_5_Over_By_Means_Of_Travel_To_Work_School_College_Motorcycle_Scooter_2011))+
geom_boxplot()
g5+coord_flip()
g6 = ggplot(d3, aes(County,
d3$Population_Aged_5_Over_By_Means_Of_Travel_To_Work_School_College_Car_Driver_2011))+
geom_boxplot()
g6+coord_flip()
g7 = ggplot(d3, aes(County,
d3$Population_Aged_5_Over_By_Means_Of_Travel_To_Work_School_College_Car_Passenger_2011))+
geom_boxplot()
g7+coord_flip()
# percentage of people leaving home between 8-9
(sum(data[,27])+sum(data[,28]))/sum(data[,32])
# proportion of people willing to travel for more than 45 mins
(sum(d2[,36])+sum(d2[,37])+sum(d2[,38]))/sum(d2[,40])
# As evident from the result, only 12% of the population in my county are
# willing to travel for more than 45 mins
table(data$County)
table(data$NUTS_III)
df1 = filter(data, NUTS_III == "Border")
df1 = data %>%
filter(NUTS_III == "Border") %>%
select(County, Population_Aged_5_Over_By_Journey_Time_To_Work_School_College_One_And_Half_Hours_And_Over_2011,
Population_Aged_5_Over_By_Journey_Time_To_Work_School_College_One_Hour_To_Under_One_Hour_Thirty_Mins_2011,
Population_Aged_5_Over_By_Journey_Time_To_Work_School_College_Three_Quarter_Hours_To_Under_One_Hour_2011,
Population_Aged_5_Over_By_Journey_Time_To_Work_School_College_Total_2011)
df1 %>%
group_by(County) %>%
summarize(over_1_30_hr = sum(Population_Aged_5_Over_By_Journey_Time_To_Work_School_College_One_And_Half_Hours_And_Over_2011),
one_1_30_hr = sum(Population_Aged_5_Over_By_Journey_Time_To_Work_School_College_One_Hour_To_Under_One_Hour_Thirty_Mins_2011),
fourt_five_1_hr = sum(Population_Aged_5_Over_By_Journey_Time_To_Work_School_College_Three_Quarter_Hours_To_Under_One_Hour_2011),
total = sum(Population_Aged_5_Over_By_Journey_Time_To_Work_School_College_Total_2011))
df2 = data %>%
filter(NUTS_III ==...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here
April
January
February
March
April
May
June
July
August
September
October
November
December
2025
2025
2026
2027
SunMonTueWedThuFriSat
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
00:00
00:30
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
05:30
06:00
06:30
07:00
07:30
08:00
08:30
09:00
09:30
10:00
10:30
11:00
11:30
12:00
12:30
13:00
13:30
14:00
14:30
15:00
15:30
16:00
16:30
17:00
17:30
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
23:30