Skip to content
Prev 3076 / 10988 Next

[Rcpp-devel] Limit of 20 on length of Rcpp::List::create?

Greetings.? It appears that there is a limit of 20 items in a list created by;

??? Rcpp::List:create

I.e., the appended code works as expected if I omit all references to "x21",
but fails with an error (shown below, after the code example) when I include
"x21".? (The successful output shown below is, obviously, for the case in
which "x21" was NOT included.)

A workaround appears to be just to pack the items into sublists and return the
sublists.? I just want to be sure I've understood correctly.

Thanks,

-- Mike


#+BABEL: :session *R* :cache yes :results output verbatim :exports both :tangle yes

* Return a long list

#+begin_src R
??? library(Rcpp)
??? library(inline)

??? includes = '
??? '

??? ccode = '
????? int x1? (1);
????? int x2? (2);
????? int x3? (3);
????? int x4? (4);
????? int x5? (5);
????? int x6? (6);
????? int x7? (7);
????? int x8? (8);
????? int x9? (9);
????? int x10 (10);
????? int x11 (11);
????? int x12 (12);
????? int x13 (13);
????? int x14 (14);
????? int x15 (15);
????? int x16 (16);
????? int x17 (17);
????? int x18 (18);
????? int x19 (19);
????? int x20 (20);
????? int x21 (21);

????? return (Rcpp::List::create(
????????????????? Rcpp::Named("x1")? = x1,
????????????????? Rcpp::Named("x2")? = x2,
????????????????? Rcpp::Named("x3")? = x3,
????????????????? Rcpp::Named("x4")? = x4,
????????????????? Rcpp::Named("x5")? = x5,
????????????????? Rcpp::Named("x6")? = x6,
????????????????? Rcpp::Named("x7")? = x7,
????????????????? Rcpp::Named("x8")? = x8,
????????????????? Rcpp::Named("x9")? = x9,
????????????????? Rcpp::Named("x10") = x10,
????????????????? Rcpp::Named("x11") = x11,
????????????????? Rcpp::Named("x12") = x12,
????????????????? Rcpp::Named("x13") = x13,
????????????????? Rcpp::Named("x14") = x14,
????????????????? Rcpp::Named("x15") = x15,
????????????????? Rcpp::Named("x16") = x16,
????????????????? Rcpp::Named("x17") = x17,
????????????????? Rcpp::Named("x18") = x18,
????????????????? Rcpp::Named("x19") = x19,
????????????????? Rcpp::Named("x20") = x20,
????????????????? Rcpp::Named("x21") = x21
????????????????? )
????? );
??? '
??? fn = cxxfunction(
????? sig????? = signature(),
????? body???? = ccode,
????? includes = includes,
????? plugin?? = "Rcpp")

? fn()

#+end_src

#+results[0bbf13bdc92f7b08c3d0922279abf8d31332c7e0]:
#+begin_example
?$x1
[1] 1

$x2
[1] 2

$x3
[1] 3

$x4
[1] 4

$x5
[1] 5

$x6
[1] 6

$x7
[1] 7

$x8
[1] 8

$x9
[1] 9

$x10
[1] 10

$x11
[1] 11

$x12
[1] 12

$x13
[1] 13

$x14
[1] 14

$x15
[1] 15

$x16
[1] 16

$x17
[1] 17

$x18
[1] 18

$x19
[1] 19

$x20
[1] 20
#+end_example

-----

Error in compileCode(f, code, language = language, verbose = verbose) : 
? Compilation ERROR, function(s)/method(s) not created! file1a507fc6.cpp: In
function ?SEXPREC* file1a507fc6()?:
file1a507fc6.cpp:76:17: error: no matching function for call to
?Rcpp::Vector<19>::create(Rcpp::traits::named_object<int>,
Rcpp::traits::named_object<int>, Rcpp::traits::named_object<int>,
Rcpp::traits::named_object<int>, Rcpp::traits::named_object<int>,
Rcpp::traits::named_object<int>, Rcpp::traits::named_object<int>,
Rcpp::traits::named_object<int>, Rcpp::traits::named_object<int>,
Rcpp::traits::named_object<int>, Rcpp::traits::named_object<int>,
Rcpp::traits::named_object<int>, Rcpp::traits::named_object<int>,
Rcpp::traits::named_object<int>, Rcpp::traits::named_object<int>,
Rcpp::traits::named_object<int>, Rcpp::traits::named_object<int>,
Rcpp::traits::named_object<int>, Rcpp::traits::named_object<int>,
Rcpp::traits::named_object<int>, Rcpp::traits::named_object<int>)?
file1a507fc6.cpp:76:17: note: candidates are:
/usr/lib64/R/library/Rcpp/include/Rcpp/ve
In addition: Warning message:
running command '/usr/lib64/R/bin/R CMD SHLIB file1a507fc6.cpp 2>
file1a507fc6.cpp.err.txt' had status 1 


------
R version 2.13.1 (2011-07-08)
Platform: x86_64-redhat-linux-gnu (64-bit)

locale:
?[1] LC_CTYPE=en_US.UTF-8?????? LC_NUMERIC=C?????????????? LC_TIME=en_US.UTF-8?????? 
?[4] LC_COLLATE=en_US.UTF-8???? LC_MONETARY=C
LC_MESSAGES=en_US.UTF-8?? 
?[7] LC_PAPER=en_US.UTF-8?????? LC_NAME=C????????????????? LC_ADDRESS=C????????????? 
[10] LC_TELEPHONE=C???????????? LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C?????? 

attached base packages:
[1] stats???? graphics? grDevices datasets? utils???? methods?? base????