How to add a new column to a data frame in R

One of the first things I struggled with when learning to write R code, was how to add a new column to a data frame in R. For example, we have a data frame, userdata, with the following three columns…
One of the first things I struggled with when learning to write R code, was how to add a new column to a data frame in R. For example, we have a data frame, userdata, with the following three columns…