[R] Error message: object of type 'closure' is not subsettable

Aparna Sampath aparna.sampath26 at gmail.com
Tue Feb 28 09:23:29 CET 2012


Hi All

I am trying to use the unlist() in R to a list variable.  The following
statements are within a function. 
{
denominator <- sqrt(s1 / res.em1$n + s2 / res.em2$n) 
 returnValue <- l2 / (denominator + 11)
  attr(returnValue,"numerator") <- l2
  attr(returnValue,"denominator") <- denominator
  returnValue
}

And when I try to unlist the variable returnValue

 numerators <- unlist(testStatistics["numerator",])
  denominators <- unlist(testStatistics["denominator",])

I get the following error: 

>Error in testStatistics["numerator", ] : 
  object of type 'closure' is not subsettable

I read some threads in R help on this error and they had asked to check if
we are using the right datatype to the right function. But in my case it is
pretty straightforward since I just list it in one function and try to
unlist it later. Any suggestions?
Thanks for the help :)

--
View this message in context: http://r.789695.n4.nabble.com/Error-message-object-of-type-closure-is-not-subsettable-tp3752886p4427399.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list