On 01-May-10 14:46:28, Giovanni Azua wrote:> Hello,
> What would be in R the closest match to a c-struct? e.g. data.frame
> requires all elements to be of the same length ... or is there a way to
> circumvent this?
>
> TIA,
> Best regards,
> Giovanni
Well, 'list' must be pretty close! The main difference would be
that in C the structure type would be declared first, and then
applied to create an object with that structure, whereas an R
lists are created straight off. If you want to set up a generic
list type for a certain purpose, you would wrap its definition
in a function.
Another difference is that R lacks the "pointer" type, so that
R's "mylist$component" is the equivalent of C's
"mylist.component";
I don't think you can do the equivalent in R of C's
"mylist->component"
(though I'm likely to be wrong about that, and to be promptly corrected)!
Hopingb this helps,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 01-May-10 Time: 16:04:06
------------------------------ XFMail ------------------------------