-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfaq.R
29 lines (22 loc) · 1.33 KB
/
faq.R
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
library("dplyr")
# average number of bedrooms in the houses priced over 1 million
bedrooms.average <- toString(round(filter(house.data, price > 1000000) %>%
summarise(mean = mean(bedrooms))))
# average number of bathrooms in the houses with 3 or more bedrooms
bathrooms.average <- toString(round(filter(house.data, bedrooms >= 3) %>%
summarise(mean = mean(bathrooms))))
# average price of the houses in the best condition
best.condition.price <- toString(round(filter(house.data, condition == max(condition)) %>%
summarise(mean = mean(price))))
# price of the house with max/min total area
specific.price <- toString(filter(house.data, total_area == max(total_area)) %>%
select(price))
# average price of th houses with a watefront
waterfront.price <- toString(round(filter(house.data, waterfront ==1) %>%
summarise(mean = mean(price))))
# average price of the houses in every zipcode
zipcode.price <- group_by(house.data, zipcode) %>%
summarise(mean = mean(price))
# zipcode of the area with the highest priced houses on an average
zipcode.highest.price <- toString(filter(zipcode.price, mean == max(mean)) %>%
select(zipcode))