Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. library(ggplot2)
  2. library(gapminder)
  3. library(dplyr)
  4. library(tidyverse)
  5. setwd("/Users/Kann/Dropbox/Uni/R")
  6. hp<-read.csv2("huspriser.csv",sep=";",header=TRUE)
  7.  
  8. # Filter USA to seperate dataset
  9. USA <- hp %>%
  10. filter(LOCATION == "USA")
  11.  
  12. # Filter DK to seperate dataset
  13. DK <- hp %>%
  14. filter(LOCATION == "DNK")
  15.  
  16. #Plotting USA and DK houseprices on top of eachother
  17. plot_usaDK_real <- ggplot() +
  18. geom_line(USA, mapping = aes(x = TIME, y=Value, color = LOCATION))+
  19. geom_line(DK, mapping = aes(x=TIME, y=Value, color= LOCATION))+
  20. labs(x = "Year", y= "REAL Houseprices",
  21. title = "Fig 1, Houseprices for USA and DK",
  22. subtitle = "index 2015 = 100",
  23. caption = "Source : OECD 'House Prices'")+
  24. theme_minimal()+
  25. theme(text = element_text(size = 12 ),
  26. axis.text.x = element_text(angle=90, vjust=0.5))+
  27. scale_x_continuous(breaks = 1995:2015)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement