Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. # help
  2. help(plot)
  3. help(mtcars)
  4.  
  5. # mtcars
  6. head(mtcars)
  7.  
  8. # variable info
  9. str(mtcars)
  10.  
  11. # One continuous variable
  12. plot(mtcars$mpg)
  13.  
  14. # One categorical variable
  15. plot(as.factor(mtcars$cyl))
  16.  
  17. # Two continuous variables
  18. plot(mtcars$disp, mtcars$mpg)
  19.  
  20. # Two categorical variables
  21. plot(as.factor(mtcars$am), as.factor(mtcars$cyl))
  22.  
  23. # Continuous/Categorical variable
  24. plot(mtcars$mpg, mtcars$cyl)
  25.  
  26. # Categorical/Continuous variable
  27. plot(as.factor(mtcars$cyl), mtcars$mpg)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement