Hi Aparna, Can you please post a reproducible example? It is difficult to provide much concrete help without having "testStatistics". One thing you might try is looking at:
str(testStatistics["numerator",]) is it actually a list? If it is not (most likely given the error) and it is supposed to be, you need to figure out what aspect of the generation of it is going awry. Cheers, Josh On Tue, Feb 28, 2012 at 12:23 AM, Aparna Sampath <aparna.sampat...@gmail.com> wrote: > 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. > > ______________________________________________ > 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. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ ______________________________________________ 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.