[R] accessing list elements

2008-07-29 Thread Paul Adams

Hello everyone,
I have a list which I am trying to calculate a max value.I have the list as 
w<-c(v[[1]][1],...v[[100]][1]). The problem I am getting is that the function 
max is saying the list is an "invalid
type (list) of  argument".When I show the element v[[1]][1] it shows as 
$statistic,V,736.I am only wanting to use the number 736 from v[[1]][1] but am 
not sure how to access that number only?I believe if I just use the number then 
I should be able to calculate the max.
 
Any help would be appreciated
Paul
 


  
[[alternative HTML version deleted]]

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


Re: [R] accessing list elements

2008-07-29 Thread Sarah Goslee
What's  v? And w? And what exactly do you want to do?

A small reproducible example would be very helpful. Without
knowing what your data look like, it's hard to make helpful
suggestions.

Sarah

On Tue, Jul 29, 2008 at 12:56 PM, Paul Adams <[EMAIL PROTECTED]> wrote:
>
> Hello everyone,
> I have a list which I am trying to calculate a max value.I have the list as 
> w<-c(v[[1]][1],...v[[100]][1]). The problem I am getting is that the function 
> max is saying the list is an "invalid
> type (list) of  argument".When I show the element v[[1]][1] it shows as 
> $statistic,V,736.I am only wanting to use the number 736 from v[[1]][1] but 
> am not sure how to access that number only?I believe if I just use the number 
> then I should be able to calculate the max.
>
> Any help would be appreciated
> Paul
>

-- 
Sarah Goslee
http://www.functionaldiversity.org

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


Re: [R] accessing list elements

2008-07-29 Thread Erik Iverson

Hello -

Paul Adams wrote:

Hello everyone, I have a list which I am trying to calculate a max
value.I have the list as w<-c(v[[1]][1],...v[[100]][1]). The problem
I am getting is that the function max is saying the list is an
"invalid type (list) of  argument".When I show the element v[[1]][1]
it shows as $statistic,V,736.I am only wanting to use the number 736
from v[[1]][1] but am not sure how to access that number only?I
believe if I just use the number then I should be able to calculate
the max.

Any help would be appreciated Paul


Please see footer of this message, which states "...provide commented, 
minimal, self-contained, reproducible code."


You do not do this.

Is your problem like this?

a <- list(20, 30)
max(a) ##error
max(unlist(a)) ##no error







[[alternative HTML version deleted]]






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


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