[R] extraction of element

Joshua Wiley jwiley.psych at gmail.com
Sun Nov 21 01:05:23 CET 2010

Hi Mary,

You're really close, the issue is that you have a list, not a vector
(see the documentation for ?integrate).  So, you need to use:

1 - Beta[[1]]

or (again relying on the documentation), you could also use $ and call
it by name:

1 - Beta$value



On Sat, Nov 20, 2010 at 3:52 PM,  <mmstat at comcast.net> wrote:
> Hello,
> I want only the value of Beta so the statement  Power<-1-Beta[1] works right.
> How to do?  See code below
> Beta <- integrate(dnorm,mean=0,sd=1, 2.3552,Inf)
> Power<- 1-Beta[1]
> Sincerely,
> Mary A. Marion
> ______________________________________________
> R-help at 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
University of California, Los Angeles

More information about the R-help mailing list