A Programming Concepts

  1. Use the assignment operator <- and the concatenate function c() 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')
  1. Use the vector age to compute a vector of the years in which your family members were born and assign them to a new object called birthyear. Use an appropriate function to show that birthyear is a numeric vector
birthyear <- 2017 - age
typeof(2017 - age)
  1. Create a tibble named family using the vectors age, gender and birthyear from 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)