Skip to content

Latest commit

 

History

History
6 lines (4 loc) · 790 Bytes

dataFrameAsList.md

File metadata and controls

6 lines (4 loc) · 790 Bytes

Data Frame as List

An important aspect of a data frame is that it is also a list(), where each column in the data frame is an item in the list. This is why when you look at a data frame in the Environment pane in RStudio, you see the following, where the list items are displayed in rows (when one might expect the columns to be rendered in columns):

Each item in the list can then be accessed with the extract or $ operator, which extracts items from lists. In a data frame, the content in each element of the list consists of one vector, and remember, all elements in a vector are of the same data type (e.g. character, numeric, date, logical, etc.).