SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Creare data.frame noi
  2. Female <- data.frame("V1"=c(40,42,50), "V2"=c(0,2,3))
  3. Male <- data.frame("V1"=c(60,40), "V2"=c(3,2))
  4. People <- rbind(Female,Male)
  5.  
  6. #Import csv Excercitiul 2
  7. setwd("d:\\MASTER\\Introducere in R\\R\\")
  8. hsdem <- read.csv("hsdem.csv")
  9. hstest <- read.csv("hstest.csv")
  10. hs2 <- merge(hsdem,hstest)
  11.  
  12. #ex 3
  13. note <- data.frame("Sem 1"=c(8.75,7.35,7.75,9.35,9.75),"Sem 2"=c(9.25,8.35,8.25,9.45,10))
  14. grades <- stack(note)
  15. gradesunstacked <- unstack(grades)
  16.  
  17. #ex 4
  18. buildings <- data.frame(location=c(1, 2, 3), name=c("building1", "building2", "building3"))
  19. data <- data.frame(survey=c(1,1,1,2,2,2), location=c(1,2,3,2,3,1), efficiency=c(51,64,70,71,80,58))
  20. buildingStats <- merge(buildings,data, by.x = "location")
  21.  
  22. #ex 5
  23. buildings <- data.frame(location=c(1, 2, 3), name=c("building1", "building2", "building3"))
  24. data <- data.frame(survey=c(1,1,1,2,2,2), LocationID=c(1,2,3,2,3,1),
  25.                    efficiency=c(51,64,70,71,80,58))
  26. buildingStats <- merge(buildings, data, by.x = "location", by.y ="LocationID")
  27.  
  28. # ex 6
  29. # scoatem argumentul by.x by.y pentru ca este inutile
  30. # merge(buildings, data)
  31.  
  32. #ex 7
  33. buildingStates <- merge(buildings, data, by.x="location",all=TRUE)
  34.  
  35. #ex 8
  36. buildingStates <- merge(buildings, data, by="location",all.x=TRUE)
  37.  
  38. #ex 10
  39. buildings <- data.frame(location=c(1, 2, 3), name=c("building1", "building2", "building3"))
  40. buildings2 <- data.frame(location=c(5, 4, 6), name=c("building5", "building4", "building6"))
  41. buildingStates <- merge(buildings,buildings2, all=TRUE)
  42.  
  43. # ex 11
  44. world95 <- read.csv("World95.csv")
  45.  
  46. #
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top