Hi Michael, Thanks for help on double brackets: I wasn't aware of this use of them.
I went back to readjust my array so the dimnames(data11a)[[2]] would have two elements, and remade the array to include the new dimnames: dimnames(data11a)[[2]]=c("V","R") so that inside the second car of the train would be two items? There seems to be no way to define dimnames(data11a)[2] to be two elements rather than one[as you say we have no way to combine the elements of the train except using the train]. So having tried to do what I can to make the middle element of the list to two rather than one, I rerun the analysis with the same result. if I read the thing right, regardless of how I define the "inside" of the boxcar, the analysis that I referred to          res11a = inneropt(coefs, times=times, data=data11a, lik=lik,          proc=proc, pars=spars, in.meth='nlminb', control.in=control.out) still won't look at the 'contents' of the car, but gives the same message:          Error in `colnames<-`(`*tmp*`, value = c("V", "R")) :          length of 'dimnames' [2] not equal to array extent I've tried a couple of other things like, after defining the second boxcar as:          dimnames(data11a)[[2]]=c("V","R") then           dimnames(data11a)[2]=list(dimnames(data11a)[[2]]) but this last generates an error. Somehow I think that that the clue to the thing is in the error message: what I see[ with my untrained eye] is that there should be some way to reconcile the three-- colnames, dimnames and the array- to a greater degree than their present agreement. Am I right? regards, Russell Tue, 14 Aug 2012 01:27:50 -0400 Ð¾Ñ "R. Michael Weylandt" <michael.weyla...@gmail.com>: > >On Mon, Aug 13, 2012 at 5:10 AM, aleksandr russell <sss...@gmail.com> wrote: > > Hello, > > > > I'm hoping someone with a wide experience with R may be able to see > > what the program is trying to tell me. > > > > I've got an array: > > > > y1=rnorm(41,0.2) > > y2=rnorm(41,0.2) > > y3=rbind(y1,y2) > > > > > > > > data11<-array(0,c(41,2,2)) > > data11[,1,]=y3 > > data11[,2,]=y3 > > rownames(data11)<-rownames(data11, do.NULL = FALSE, prefix = "Obs.") > > colnames=c("V","R") > > varnames=c("one","two") > > dimnames(data11)<-list(rownames(data11), varnames, colnames) > > > > > > > > data11a<-as.array(data11, dimnames=dimnames(data11)) > > # No effect here >  identical(data11, data11a) # TRUE > > > > > The analysis that I would like to do with R(CollocInfer) runs as > > follows(I print for the sake of introduction here though to run this > > line of code requires extensive setup) > > > > res11a = inneropt(coefs, times=times, data=data11a, lik=lik, > > proc=proc, pars=spars, in.meth='nlminb', control.in=control.out) > > > > > > > > The response I get is > > > > Error in 'colnames<-'('*tmp*', value = c("V","R")) : > > length of 'dimnames' [2] not equal to array extent > > > > > > > > It seems to me that there is a fundamental match of 'dimnames' with > > the array that is being referred to. > > > > I have learned that the normal length of dimnames for an array is one > > for each element in the list: thus as I've set up the array, the > > length(dimnames(data11a)[2]) gives me > > > > [1] > > I believe you are looking for > > length(dimnames(data11a)[[2]]) # 2 > > Look into the difference between `[` and `[[` for subsetting a list. > See ?Extract for the gorey details, but I like my little train > metaphor: > > If the list "x", is a train: x[2] is the "sub-train" consisting only > of the second car, while x[[2]] is the contents of that second car. > Hence we can do x[1:3] to give a well defined train, but not x[[1:3]] > because we have no way to combine the elements of the first three cars > other than using a train. > > Cheers, > Michael > > > > > I would like to ask :Is it not evident from R's response that there is > > some other possibility for the dimnames[2] of the array? > > > > If so, what is it? > > > > regards, > > A > > > > ______________________________________________ > > 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.