Dear all I would like to have in R a big struct containing a smaller struct.
I have tried something that I would like to share and ask your help make it work 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: 1) Estimationstruct <- function ( xorder, yorder, estimated) list (xorder= xorder, yoder=yorder,estimated=estimated) 2) per.sr.struct <-replicate(10,Estimationstruct(vector(mode="integer",length=1),vector(mode="integer",length=1), matrix(data=NA,nrow=256,ncol=256)),simplify=FALSE) That one worked. per.sr.struct contains 10 elements and each one of that contains 1). This works fine: str(per.sr.struct[[1]]) List of 3 $ xorder : int 0 $ yoder : int 0 $ estimated: logi [1:256, 1:256] NA NA NA NA NA NA .. Then I would like 3) to have 20 times the number two. For that I tried out all.sr.struct<-replicate(20,per.sr.struct) The idea is to have 20 all.sr.stuct and each element to contain one per.sr.struct. What is wrong with my reasoning? Best Regards Alex but I am not sure if this works correctly. I have tried somet ______________________________________________ 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.