[R] function restrictedparts
Matt Shotwell
matt at biostatmatt.com
Wed Jan 25 19:43:52 CET 2012
That's because the number of partitions of 281 items of order 10 is
quite large:
R> library('partitions')
R> R(10,281)
[1] 1218681472
Without thinking about this too hard, the result of
restrictedparts(281,10) should require around
R> 1218681472 * 10 * 4 / 10^9
[1] 48.74726
gigabytes of storage space (because the result is a 1218681472 x 10
array of 4 byte integers).
Because the number of partitions grows 'explosively' with the number of
items, this is a serious obstacle for statistical partitioning and
clustering methods. For more discouragement, see the 'Bell number'.
You can enumerate these restricted partitions one by one; see
R> ?partitions::nextpart
Matt
On Wed, 2012-01-25 at 15:11 +0000, yan jiao wrote:
> I am using function restrictedparts, but got error:
>
>
> restrictedparts(281,10)
> Error in integer(len) : vector size specified is too large
> Calls: restrictedparts -> integer
> In addition: Warning message:
> In restrictedparts(281, 10) : NAs introduced by coercion
> Error in integer(len) : vector size specified is too large
> Calls: restrictedparts -> integer
>
>
> is there a similar function can deal with long vector?
>
> I'm using R version 2.14.1 (2011-12-22),x86_64, linux-gnu
>
> many thanks
>
> yan
>
> ______________________________________________
> 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