Problem Part 1: reference

  • Data frame columns are not objects in the global environment…
  • … but we want to address them as such
# proper search path: from environment object to column
mean(mtcars$cyl + mtcars$am)

# improper search: this is not the object you seek
mean(cyl + am)