Skip to content
Prev 5334 / 63421 Next

Segmentation fault in subscripting array of lists (PR#904)

R clearly shouldn't crash, but tmp[[1, ]] is semantically incorrect.  The
result of "[[" is required to be a single value from a vector (or generally,
an array) of the mode of the vector.  To select more than one element from
an array, you must use "[".  The results from S-PLUS 6 are:
Problem in [[: Attempt to select more than one element: structure(list(NULL,
NULL, NULL, list(fred = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)), NULL, NUL....
Use traceback() to see the call stack

This error message indicates the error.  Using "[" gives the correct result:
[[1]]:
NULL

[[2]]:
[[2]]$fred:
 [1]  1  2  3  4  5  6  7  8  9 10


[[3]]:
NULL

[[4]]:
NULL


# David Smith

--
David M Smith <dsmith@insightful.com>
S-PLUS Product Marketing Manager, Insightful Corp, Seattle WA
Tel: +1 (206) 283 8802 x360
Fax: +1 (206) 283 0347

MathSoft is now Insightful!  See www.insightful.com for details.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._