Hi all,I have seen data.frames and operations from the mutate package getting really popular. In the last years I have been using extensively lists, is there any reason to not use lists and use other data types for data manipulation and storage? Any article that describe their differences??I would like to thank you for your replyRegardsAlex [[alternative HTML version deleted]]
> On Sep 14, 2016, at 8:01 AM, Alaios via R-help <r-help at r-project.org> wrote: > > Hi all,I have seen data.frames and operations from the mutate package getting really popular. In the last years I have been using extensively lists, is there any reason to not use lists and use other data types for data manipulation and storage? > Any article that describe their differences? I would like to thank you for your replyRegardsAlexHi, Presuming that you are referring to the mutate() **function**, which is in the dplyr package on CRAN, that package provides a variety of functions to manipulate data in R. Data frames **are** lists with a data.frame class attribute, but with the proviso that each column in the data frame, which is a list element, has the same length, but like a list, may have different data types (e.g. character, numeric, etc.). Thus, a data frame is effectively a rectangular data structure, conceptually in the same manner as an Excel worksheet. A list, which is a more generic data structure, can contain list elements of variable lengths and data types. You might want to begin by reviewing: https://cran.r-project.org/doc/manuals/r-release/R-intro.html#Lists-and-data-frames which is a section on lists and data frames in the Introduction To R Manual. It would be surprising, to me at least, that you have been using R for several years and have not come across data frames, since they are used in many typical operations, including regression models and the like. Regards, Marc Schwartz
This is partially a matter of subjectve opinion, and so pointless; but I would point out that data frames are the canonical structure for a great many of R's modeling and graphics functions, e.g. lm, xyplot, etc. As for mutate() etc., that's about UI's and user friendliness, and imho my ho is meaningless. Best, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Sep 14, 2016 at 6:01 AM, Alaios via R-help <r-help at r-project.org> wrote:> Hi all,I have seen data.frames and operations from the mutate package getting really popular. In the last years I have been using extensively lists, is there any reason to not use lists and use other data types for data manipulation and storage? > Any article that describe their differences? I would like to thank you for your replyRegardsAlex > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
thanks for all the answers. I think also ggplot2 requires data.frames.If you want to add variable to data.frame you have to use attach, detach. Right?Any more links that discuss thoe two different approaches?Alex On Wednesday, September 14, 2016 5:34 PM, Bert Gunter <bgunter.4567 at gmail.com> wrote: This is partially a matter of subjectve opinion, and so pointless; but I would point out that data frames are the canonical structure for a great many of R's modeling and graphics functions, e.g. lm, xyplot, etc. As for mutate() etc., that's about UI's and user friendliness, and imho my ho is meaningless. Best, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Sep 14, 2016 at 6:01 AM, Alaios via R-help <r-help at r-project.org> wrote:> Hi all,I have seen data.frames and operations from the mutate package getting really popular. In the last years I have been using extensively lists, is there any reason to not use lists and use other data types for data manipulation and storage? > Any article that describe their differences? I would like to thank you for your replyRegardsAlex >? ? ? ? [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]