Create dataframe
Create variables
## i. name
names <- c("Ada","Robert","Mia")
## ii. age
ages <- c(20,21,22)
## iii. Factor, so that you can add levels that not exist in the data
year <- c("Freshman","Sophomore","Junior")
year <- factor(year, levels=c("Freshman","Sophomore",
"Junior","Senior"))
Create dataframe
students <- data.frame(names,ages,year)
Query a dataframe
students$names
Set working dictory
get working dicrectory
getwd()
set working directory
setwd()
or go to “session” and set working directory
or build R file in the directory you want to work in