A Programming Concepts
- Use the assignment operator
<-and the concatenate functionc()to create two vectors:
- vector
age, containing the ages of your family members - vector
gender, containing the genders of your family members
age <- c(26, 29, 65, 64)
gender <- c('F', 'M', 'M', 'F')- Use the vector
ageto compute a vector of the years in which your family members were born and assign them to a new object calledbirthyear. Use an appropriate function to show thatbirthyearis a numeric vector
birthyear <- 2017 - age
typeof(2017 - age)- Create a tibble named family using the vectors
age,genderandbirthyearfrom question 1 and 2 as column variables. What is the type of each variable in the tibble? What is the type of a tibble object?
family <- tibble(age, gender, birthyear)
typeof(family)