I was talking with another guy on the list about this very topic.

A simple example would help.

first a sample C struct, and then how one would do the equivalent in R.

In the end i suppose one want to do a an 'array' of these structs, or list
of the structs.

On Sat, May 1, 2010 at 8:04 AM, Ted Harding <ted.hard...@manchester.ac.uk>wrote:

> 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.hard...@manchester.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 01-May-10                                       Time: 16:04:06
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to