In this short R tutorial, you will learn how to add an empty column to a dataframe in R. Specifically, you will learn 1) to add an empty column using base R, 2) to add an empty column using the add_column function from the package tibble and we are going to use a pipe (from dplyr). Now, dplyr comes with many handy functions that, apart from adding columns, make it easy to remove a column from the R dataframe (e.g., using the select() function). Both tibble and dplyr are part of the tidyverse package.
The outline of this post is as follows:
- Reading Data from an Excel File
- How to Add an Empty Column to the Dataframe with:
- Base R
- add_column()
- How to Add Multiple Empty Columns with:
- Base R
- add_column()
