Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. attach(trustData)
  2.  
  3. ag<-aggregate(trustData, by = list(type = face_category_and_gender2_ZAUFANIE), mean)
  4.  
  5. plot <- ggplot(data=ag, aes(x=type, y=response)) + list(geom_point(colour= 'red'))
  6.  
  7. plot
  8.  
  9. library(dplyr)
  10. library(tidyr)
  11. library(ggplot2)
  12. ag %>%
  13. separate(type, into = c("val", "Type"), "(?=[A-Z])", remove = FALSE) %>%
  14. mutate(Type = factor(Type, levels =c("M", "K"), labels = c("Men", "Woman"))) %>%
  15. ggplot(., aes(x = val, y = response, col = Type)) +
  16. geom_point()
  17.  
  18. ag %>%
  19. separate(type, into = c("val", "Type"), "(?=[A-Z])", remove = FALSE) %>%
  20. mutate(Sex = case_when(.$Type == "M" ~ "Men", TRUE ~ "Woman")) %>%
  21. ggplot(., aes(x = val, y = response, col = Type)) +
  22. geom_point()
  23.  
  24. ag <- structure(list(type = c("12K", "12M", "15K", "15M", "1K", "1M",
  25. "4K", "4M", "7K", "7M", "9K", "9M"), response = c(41.83, 42.45,
  26. 40.61, 40.69, 64.59, 57.88, 61.2, 54.71, 49.23, 48.24, 44.27,
  27. 45.09)), .Names = c("type", "response"), row.names = c(NA, -12L
  28. ), class = "data.frame")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement