Objectives

To submit this homework you will create the document in Rstudio, using the knitr package (button included in Rstudio) and then submit the document to your Rpubs account. Once uploaded you will submit the link to that document on Canvas. Please make sure that this link is hyperlinked and that I can see the visualization and the code required to create it.

Look at the data

str(housing)
## 'data.frame':    72 obs. of  5 variables:
##  $ Sat : Ord.factor w/ 3 levels "Low"<"Medium"<..: 1 2 3 1 2 3 1 2 3 1 ...
##  $ Infl: Factor w/ 3 levels "Low","Medium",..: 1 1 1 2 2 2 3 3 3 1 ...
##  $ Type: Factor w/ 4 levels "Tower","Apartment",..: 1 1 1 1 1 1 1 1 1 2 ...
##  $ Cont: Factor w/ 2 levels "Low","High": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Freq: int  21 21 28 34 22 36 10 11 36 61 ...

1. First plot

Number of Resident by Satisfaction with Rental Type. Apartment residents with high contact alos have high satisfaction.

ggplot(housing) +
geom_bar(aes(x = Cont, y = Freq, fill = Sat), stat = 'identity', width =.4, position = "dodge") +
  labs(title="Number of Resident by Satisfaction with Rental Type ") + 
  labs(fill = "Satisfaction") +
  xlab("Contact") + 
  ylab("Number of Resident") +
  facet_wrap(~Type)

2. Second plot

number of residents with different levels of perceived degree of influence on the management of the property by 4 types of rental property, by amount of cost shared with other residents

ggplot(housing, aes(x = Infl, y = Freq))+
  geom_bar(
    aes(fill = Cont), stat = "identity", color = "gray",
    position = position_dodge(0.8)
    )+
  facet_wrap(~Type) 

3. Third plot

Residents in apartments with low satisfaction and influence have the highest frequency. It can be said that more people are unhappy that the management has less influence

p4<-ggplot(housing, aes(x=Infl, y=Freq)) + geom_point(shape=1)
p4+facet_grid(Type~Sat)

4. Fourth plot

Residents in Apartment and Terrace have a higher contact with other residents

p2<-ggplot(housing, aes(x=Cont, y=Freq)) + geom_point(shape=1)
p2+facet_wrap(~Type,ncol=2)

5. Fifth plot

Residents with higher satisfaction tend to have higher contact with other residents.

ggplot(housing, aes(x=Sat, y=Freq)) + geom_point(shape=1)+
facet_grid(Cont~.)