[R] artificial data matrix with 100000 rows

Paul Smith phhs80 at gmail.com
Mon Sep 10 14:44:51 CEST 2007


On 9/10/07, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>     PS> On 9/9/07, kevinchang <shukai at seas.upenn.edu> wrote:
>     >> I tried to made the matrix with this size by either matrix() or array().
>     >> However, there seems to be default limit of number for rows made. I got sort
>     >> of error message from R .To be specific,
>     >>
>     >> m<--matrix(ncol=3,nrow=100000)
>     >>
>     >> error message:[ reached getOption("max.print") -- omitted 66667 rows ]]
>     >>
>     >> or
>     >>
>     >> a<-array(dim=c(10000,3,10))
>     >>
>     >> error message:reached getOption("max.print") -- omitted 6667 row(s) and 6
>     >> matrix slice(s) ]
>
>     PS> That is not an error message, I guess.
>
> Definitely not,
> thank you, Paul!
>
> Also, they were not produced by what Kevin showed (namely assignments)
> but rather when he *prints* the contents of his huge matrix /
> array.
>
>     PS> When the matrices are huge, R is unable to print them
>     PS> totally on the screen, but all data are present.
>
> Not at all "unable" !!
> R protects you from accidentally overflowing your "console" with
> huge amount of non-sensical output.
>
> As the warning above mentions,
> you should look at
>   ? getOption
>   ? options
> and particularly the  'max.print'  option
>
> Is  '' reached  getOption("max.print") ''
> too difficult to read?
>
> You *can* increase the 'max.print' option as much as you like,
> and that's why I said     'not at all "unable"'   above.
>
> Regards,
> Martin
>
>     PS> For instance,
>
>     >> m[(nrow(m)-10):nrow(m),]
>     PS> [,1] [,2] [,3]
>     PS> [1,]   NA   NA   NA
>     PS> [2,]   NA   NA   NA
>     PS> [3,]   NA   NA   NA
>     PS> [4,]   NA   NA   NA
>     PS> [5,]   NA   NA   NA
>     PS> [6,]   NA   NA   NA
>     PS> [7,]   NA   NA   NA
>     PS> [8,]   NA   NA   NA
>     PS> [9,]   NA   NA   NA
>     PS> [10,]   NA   NA   NA
>     PS> [11,]   NA   NA   NA
>
> or rather just
>
>    tail(m)
>
> or tail(m, 11)
> or head(m)
>
> or str(m)
>
> etc etc
>
>     PS> See
>
>     PS> ?getOption
>
> yes indeed.

Thanks, Martin, for your detailed comments. I have learned something from them.

Paul



More information about the R-help mailing list