Zhaoran Zhou
2013-Jun-28 12:30 UTC
[R] what is the difference between the function "expand.grid" and "data.frame"?
Hello everyone, i found that both of the 2 functions ("expand.grid" and "data.frame") can be used to produce data frame. are there any difference between them? thanks for your help! zhaoran [[alternative HTML version deleted]]
Ista Zahn
2013-Jun-29 13:08 UTC
[R] what is the difference between the function "expand.grid" and "data.frame"?
Why don't you try it and see? data.frame(x=1:5, y=letters[1:5]) expand.grid(x=1:5, y=letters[1:5]) ?data.frame ?expand.grid On Fri, Jun 28, 2013 at 8:30 AM, Zhaoran Zhou <zhaoran1124 at gmail.com> wrote:> Hello everyone, > > i found that both of the 2 functions ("expand.grid" and "data.frame") can > be used to produce data frame. are there any difference between them? > > thanks for your help! > > zhaoran > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > 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.
John Kane
2013-Jun-29 13:10 UTC
[R] what is the difference between the function "expand.grid" and "data.frame"?
Just have a look at the two help pages ?expand.grid and ?data.frame. R experts will wince but I believe that you can think of a data.frame as one type of R object and expand.grid as one very specialized way to create a data.frame. I guess you can say one is an object and the other is a function to create such an object. John Kane Kingston ON Canada> -----Original Message----- > From: zhaoran1124 at gmail.com > Sent: Fri, 28 Jun 2013 15:30:44 +0300 > To: r-help at r-project.org > Subject: [R] what is the difference between the function "expand.grid" > and "data.frame"? > > Hello everyone, > > i found that both of the 2 functions ("expand.grid" and "data.frame") can > be used to produce data frame. are there any difference between them? > > thanks for your help! > > zhaoran > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > 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.____________________________________________________________ FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! Visit http://www.inbox.com/photosharing to find out more!
Pascal Oettli
2013-Jun-29 13:22 UTC
[R] what is the difference between the function "expand.grid" and "data.frame"?
H ello, Did you read ?data.frame and ?expand.grid.> data.frame(x=1:2, y=1:2)x y 1 1 1 2 2 2> expand.grid(x=1:2, y=1:2)x y 1 1 1 2 2 1 3 1 2 4 2 2 There is a small difference, isn't it? Regards, Pascal 2013/6/28 Zhaoran Zhou <zhaoran1124@gmail.com>> Hello everyone, > > i found that both of the 2 functions ("expand.grid" and "data.frame") can > be used to produce data frame. are there any difference between them? > > thanks for your help! > > zhaoran > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > 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]]