[R] list

jim holtman jholtman at gmail.com
Tue Jul 29 12:06:29 CEST 2008


Is this what you are after: this comes from the example of wilcox.test
and shows the structure and how to reference the p-value:

> z <- wilcox.test(x, y, paired = TRUE, alternative = "greater")
> str(z)
List of 7
 $ statistic  : Named num 40
  ..- attr(*, "names")= chr "V"
 $ parameter  : NULL
 $ p.value    : num 0.0195
 $ null.value : Named num 0
  ..- attr(*, "names")= chr "location shift"
 $ alternative: chr "greater"
 $ method     : chr "Wilcoxon signed rank test"
 $ data.name  : chr "x and y"
 - attr(*, "class")= chr "htest"
> z$p.value
[1] 0.01953125


On Tue, Jul 29, 2008 at 1:00 AM, Paul Adams <pma3622 at yahoo.com> wrote:
> I have run a wilcox test on a dataframe and I have returned to me data which
> I am wanting to sort and/or pick the max.
> I have tried the following code to pick the max:
> v<-wilcox.test.run
> w<-max(v,na.rm=FALSE)
>
> I have also tried w<-pmax(p-value,na.rm=FALSE) for the second line
>
> and this returns the following error:invalid 'type'  (list) of argument
> This error is understandable because I am trying to find the max p-value from a list of
> 100 with the following output:
>
>
> $g100
> Wilcoxon signed rank test
> data:newX[,i]
> V=741,  p-value=8.051e-08
>
> I want to be able to pull only the maximum p-value from this output and the $g  that matches the p-value by using max.Any help would be appreciated.
>
> Thanks
> Paul
>
>
>
>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list