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