Skip to content

Instantly share code, notes, and snippets.

@toyeiei
Created November 13, 2018 03:23
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/51f8bd329ea95855852d7f36f350dbe2 to your computer and use it in GitHub Desktop.
Save toyeiei/51f8bd329ea95855852d7f36f350dbe2 to your computer and use it in GitHub Desktop.
introduction to R
# R crash course
# create vectors
customer_name <- c("David", "Mary", "John", "Jack", "Daniel")
customer_age <- c(30, 32, 28, 20, 31)
customer_gender <- c("M", "F", "M", "M", "M")
customer_purchased <- c(TRUE, FALSE, FALSE, TRUE, TRUE)
# create a dataframe
customer_dataframe <- data.frame(customer_name,
customer_age,
customer_gender,
customer_purchased)
# first look at dataframe
print(customer_dataframe)
# useful functions to work with dataframe
str(customer_dataframe)
head(customer_dataframe)
tail(customer_dataframe)
summary(customer_dataframe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment