Skip to content

Instantly share code, notes, and snippets.

@toyeiei
Last active November 2, 2018 10:56
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 toyeiei/68f5f5eefa129bedfd960c80f1068a53 to your computer and use it in GitHub Desktop.
Save toyeiei/68f5f5eefa129bedfd960c80f1068a53 to your computer and use it in GitHub Desktop.
data wrangling mini course - intro
# install package in R
install.packages("dplyr")
library(dplyr)
# useful functions to analyze dataframe
# review dataframe structure
glimpse(mtcars)
# print first six and last six rows
head(mtcars)
tail(mtcars)
# summarise key statistics of dataframe
summary(mtcars)
# number of rows in dataframe
nrow(mtcars)
# print column names
names(mtcars)
# basic statistics with dataframe
mean(mtcars$mpg)
median(mtcars$mpg)
max(mtcars$mpg)
min(mtcars$mpg)
sd(mtcars$mpg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment