[R] when to use pros/cons of dataframe vs. matrix?

2013-06-27 Thread Anika Masters
When should I use a dataframe vs. a matrix? What are the pros and cons? If I have data of all the same type, am I usually better off using a matrix and not a dataframe? What are the advantages if any of using a dataframe vs. a matrix? (rownames and column names perhaps?)

Re: [R] when to use pros/cons of dataframe vs. matrix?

2013-06-27 Thread Don McKenzie
Anika -- these are good questions and many on the list could expatiate on them. These erudite people are also busy, however, and that is why the R-news posting guide suggests that you study an introductory book on R before asking general questions. On 27-Jun-13, at 11:26 AM, Anika Masters

Re: [R] when to use pros/cons of dataframe vs. matrix?

2013-06-27 Thread arun
. - Original Message - From: Anika Masters anika.mast...@gmail.com To: R help r-help@r-project.org Cc: Sent: Thursday, June 27, 2013 2:26 PM Subject: [R] when to use pros/cons of dataframe vs. matrix? When should I use a dataframe vs. a matrix?  What are the pros and cons? If I have data

Re: [R] when to use pros/cons of dataframe vs. matrix?

2013-06-27 Thread Rui Barradas
Hello, Arun's answer shows that matrices are faster. If your data is all of the same type, then this might be a point for matrices. data.frames are better for modeling. You can use the formula interface to the many modeling functions. For instance, the example below is _not_ possible with a