Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. par(mfrow(c = 2,3))
  2.  
  3. fun_1 <- function (x)
  4.  
  5. x <- small_df %>%
  6. ggplot(aes(Country, Response, color = Country))+
  7. geom_point() +
  8. theme(axis.text.x = element_text(angle = 90, hjust = 1))
  9.  
  10. for(i in 1:7) { ## loop for each row in df
  11.  
  12. Where X = Country is constant for each loop
  13. Loop the function for all the remaining Y (BNP_USD, Currency, BirthRate)
  14. Print out a plot for each X and Y combination
  15.  
  16. }
  17.  
  18. Country <- c("BDG", "CHN", "MMR", "IDN", "IND", "LKA", "KHM")
  19. Response <- c(30, 15, 25, 10, 11, 21, 16)
  20. BNP_USD <- c(10000,20000,30000,40000,50000,60000,70000)
  21. Currency <- c(0.1, 3.2, 6.02, 8.0, 7.5, 0.06, 8.8)
  22. BirthRate <- c(4, 2, 3, 4, 2, 2, 2)
  23.  
  24. df <- data.drame(Country, Response, BNP_USD, Currency, BirthRate)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement