Convert a Vector into a Data Frame

Learn how to convert a vector into a data frame.

Convert a vector into a data frame

So far, we have been working with vectors like v1 and v2. In actual data analysis, we typically work with a dataset that has observations as rows and variables as columns. In R, we also work with this type of data object, called a data frame. A data frame in R is often displayed in matrix form, which is a two-dimensional data object consisting of rows by columns.

Get hands-on with 1200+ tech skills courses.