[R] dput data frame

Dennis Murphy djmuser at gmail.com
Thu Aug 25 07:26:35 CEST 2011


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.
>



More information about the R-help mailing list