-
-
Save toyeiei/68f5f5eefa129bedfd960c80f1068a53 to your computer and use it in GitHub Desktop.
data wrangling mini course - intro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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