Skip to content

Instantly share code, notes, and snippets.

@aravindhebbali
Last active September 26, 2017 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aravindhebbali/3690e9217c72644a9e9bada0df709426 to your computer and use it in GitHub Desktop.
Save aravindhebbali/3690e9217c72644a9e9bada0df709426 to your computer and use it in GitHub Desktop.
Data Visualization: Introduction
# help
help(plot)
help(mtcars)
# mtcars
head(mtcars)
# variable info
str(mtcars)
# One continuous variable
plot(mtcars$mpg)
# One categorical variable
plot(as.factor(mtcars$cyl))
# Two continuous variables
plot(mtcars$disp, mtcars$mpg)
# Two categorical variables
plot(as.factor(mtcars$am), as.factor(mtcars$cyl))
# Continuous/Categorical variable
plot(mtcars$mpg, mtcars$cyl)
# Categorical/Continuous variable
plot(as.factor(mtcars$cyl), mtcars$mpg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment