Advertisement
Guest User

Untitled

a guest
Jan 8th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Kod do "R" do zaliczenia Laboratorium_1. Zmieńcie parametr "setwd" na lokalizację pliku flats1.csv na dysku.
  2.  
  3. setwd("C:\\Users\\Student\\Desktop\\Sztuczna Inteligencja\\")
  4. flats <- read.csv("flats1.csv", stringsAsFactors=FALSE)
  5. class(flats)
  6. str(flats)
  7. dim(flats)
  8. head(flats,6)
  9. head(flats,15)
  10. tail(flats,6)
  11. names(flats)
  12. glimpse(flats)
  13. summary(flats)
  14. count(flats, City)
  15. flats %>% count(City) %>% arrange(n)
  16. flats %>% filter(City != "Lviv") %>% filter(Room == 3 ) %>% count(City) %>% arrange(desc(n))
  17. flats %>% filter(Room == 2) %>% filter(City != "Lviv") %>% count(City) %>% arrange(desc(n))
  18.  
  19. flats %>% filter(Room == 2) %>%
  20.   filter(City != " Kiev Svyatoshinsky ") %>%
  21.   summarise(mean(Square))
  22.  
  23. flats %>%
  24.   filter(Room == 2) %>%
  25.   filter(City != "Kharkiv") %>%
  26.   summarise(mean(Square), sd(Square))
  27.  
  28. flats %>%
  29.   filter(Room == 1) %>%
  30.   filter(City != "Kharkiv") %>%
  31.   group_by(City) %>%
  32.   summarise(mean=median(Square), sd=sd(Square))
  33.  
  34. flats %>%
  35.   filter(Room == 3) %>%
  36.   filter(City == "Odessa")
  37.  
  38. flats %>%
  39.   filter(Room == 1) %>%
  40.   filter(City == "Lviv" ) %>%
  41.   summarise(mean=median(Square))
  42.  
  43. flats %>%
  44.   filter(City == "Lviv") %>%
  45.   filter(Room == 2) %>%
  46.   summarise(var(Price))
  47.  
  48. ggplot(flats, aes(x=Room))+
  49.   geom_bar(fill="lightblue",col="grey") +
  50.   ylab(' Number ')
  51.  
  52. p <- ggplot(flats, aes(x=Square)) +
  53.   geom_bar(fill="lightblue",col="grey") +
  54.   ylab(' Number ')
  55. p
  56.  
  57. ggplot(flats, aes(x=Square)) +
  58.   geom_histogram(breaks=seq(0, 250, by = 50),fill="lightblue", col="grey") +
  59.   ylab('Number')
  60.  
  61. ggplot(flats, aes(x=Square, y= Price)) +
  62.   geom_point()
  63.  
  64. ggplot(flats, aes(x=Square, y=Price)) +
  65.   geom_boxplot() +
  66.   coord_flip()
  67.  
  68. scale_x_reverse()
  69.  
  70. df <- data.frame(x=1:5, y=(1:5)^2)
  71. ggplot(df, aes(x, y)) +
  72.   geom_area()
  73.  
  74. qplot(City, Price, data=flats, geom="boxplot")+
  75.   coord_flip()
  76.  
  77. qplot(Room, Price, data=flats, geom="boxplot")+
  78.   coord_flip()
  79.  
  80. ggplot(flats, aes(x=Square, y= Price)) +
  81.   geom_point()
  82.  
  83. ggplot(flats, aes(x=Price)) +
  84. geom_histogram(breaks=seq(0,1.2e7,by=1e6), fill="lightblue", col="grey")+
  85.   ylab('Number')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement