I have a data frame that is about 40 columns by 10000 rows. I want to get the dput of small portion of that by using dput(results[1:10,3:6]). The dput is very long and includes all the values from the original data frame. Why is that? Jeffrey
How are you storing the elements of the data frame? I'm working with a data frame of doubles with no names and having trouble observing the same problem. If they are factor levels though, that *might* account for it. sessionInfo() might also help. Obviously it's not convenient to print this example, but if you could reproduce the irregularity on a smaller data frame, that would be great as well. Michael Weylandt On Wed, Aug 24, 2011 at 6:48 PM, Jeffrey Joh <johjeffrey@hotmail.com> wrote:> > I have a data frame that is about 40 columns by 10000 rows. I want to get > the dput of small portion of that by using dput(results[1:10,3:6]). The > dput is very long and includes all the values from the original data frame. > Why is that? > > > > Jeffrey > ______________________________________________ > 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]]
On Aug 24, 2011, at 6:48 PM, Jeffrey Joh wrote:> > I have a data frame that is about 40 columns by 10000 rows. I want > to get the dput of small portion of that by using > dput(results[1:10,3:6]). The dput is very long and includes all the > values from the original data frame. Why is that? >I am guessing that you have factors with numerous levels that you are incorrectly interpreting as "all the values from the original data frame". Hard to do more than guess, given the description. -- David Winsemius, MD West Hartford, CT
Hi: Try this instead: m <- matrix(rpois(400000, 10), nrow = 10000)> dim(m)[1] 10000 40 r <- m[1:10, 3:6] dput(r) structure(c(12, 7, 15, 8, 6, 7, 14, 10, 11, 4, 9, 16, 12, 5, 9, 10, 9, 9, 8, 7, 12, 9, 10, 12, 12, 11, 11, 8, 12, 8, 15, 21, 3, 3, 13, 9, 8, 13, 7, 11), .Dim = c(10L, 4L)) # Alternatively, dput(r <- m[1:10, 3:6]) structure(c(12, 7, 15, 8, 6, 7, 14, 10, 11, 4, 9, 16, 12, 5, 9, 10, 9, 9, 8, 7, 12, 9, 10, 12, 12, 11, 11, 8, 12, 8, 15, 21, 3, 3, 13, 9, 8, 13, 7, 11), .Dim = c(10L, 4L)) HTH, Dennis On Wed, Aug 24, 2011 at 3:48 PM, Jeffrey Joh <johjeffrey at hotmail.com> wrote:> > I have a data frame that is about 40 columns by 10000 rows. ?I want to get the dput of small portion of that by using dput(results[1:10,3:6]). ?The dput is very long and includes all the values from the original data frame. ?Why is that? > > > > Jeffrey > ______________________________________________ > 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. >