[R] Help me create a hyper-structure
Alaios
alaios at yahoo.com
Sat Apr 16 16:51:13 CEST 2011
Dear Ben,
I would like to thank you for your answer.
Unfortunately is not very clear how simplify works and what is the difference between TRUE and FALSE ( I am not at work right now to check the difference)
Regards
Alex
--- On Sat, 4/16/11, Ben Bolker <bbolker at gmail.com> wrote:
> From: Ben Bolker <bbolker at gmail.com>
> Subject: Re: [R] Help me create a hyper-structure
> To: r-help at stat.math.ethz.ch
> Date: Saturday, April 16, 2011, 3:39 PM
> Alaios <alaios <at>
> yahoo.com> writes:
>
> >
> > Dear all
> > I would like to have in R a big struct containing a
> smaller struct.
> >
> > 1) I would like to have a small struct with the
> following three fields
> > xorder (an integer ranging from 0 to 20)
> > yorder (an integer ranging from 0 to 20)
> > estimated (a 256*256 matrix)
> >
> > 2) I would like to have 10 elements of the struct
> above
> > for that I wrote the following:
> >
> Estimationstruct <- function ( xorder, yorder,
> estimated) {
> list (xorder= xorder,
> yorder=yorder,estimated=estimated)
> }
>
> per.sr.struct <- replicate(10,
>
> Estimationstruct(0L,0L,matrix(nrow=256,ncol=256)),
> simplify=FALSE)
>
> > That one worked.
> > per.sr.struct contains 10 elements and each one of
> that contains 1).
>
> all.sr.struct
> <- replicate(20,per.sr.struct,simplify=FALSE)
>
> > The idea is to have 20 all.sr.stuct and each element
> > to contain one per.sr.struct.
>
> I think you just missed simplify=FALSE in the last
> step ...
>
> ______________________________________________
> 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