[R] dimnames in an array(I'll be grateful if this message will be passed to all list users)

aleksandr russell sss736 at gmail.com
Mon Aug 13 11:10:24 CEST 2012


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))

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 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



More information about the R-help mailing list