Permalink
Switch branches/tags
Nothing to show
Find file Copy path
bfb28ea Oct 29, 2015
1 contributor

Users who have contributed to this file

6 lines (4 sloc) 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.).