[ACCEPTED]-Vector vs. Data frame in R-dataframe

Accepted answer
Score: 25

A vector has 1 dimension while a data frame 10 has 2. I can't think of a good reason to 9 convert a single vector into a data frame. That 8 question generally arises when you have 7 multiple vectors.

A better question is what 6 is the difference between a data frame and 5 a matrix: a data frame can have different 4 data types for each column, while a matrix 3 is all one data type. Behind the scenes, a 2 data frame is really a list with equal length 1 vectors at each index.

Score: 5

Another good point to note is that when 3 running code, operations on matrixes are 2 (most of the time) much faster then on data 1 frames.


More Related questions