Hello everyone,
I have a vector of p-values and I am trying to find the max for the vector and 
add it to a list.I am using a loop to loop through 50 times.I have used the 
following code but it does not pick out the max and add to the list.Any help 
would be appreciated.
 
w<-c(v[[1]][3],v[[2]][3],v[[3]][3],v[[4]][3],v[[5]][3],v[[6]][3],v[[7]][3],v[[8]][3],v[[9]][3],
v[[10]][3],v[[11]][3],v[[12]][3],v[[13]][3],v[[14]][3],v[[15]][3],v[[16]][3],v[[17]][3],v[[18]][3],
v[[19]][3],v[[20]][3],v[[21]][3],v[[22]][3],v[[23]][3],v[[24]][3],v[[25]][3],v[[26]][3],v[[27]][3],
v[[28]][3],v[[29]][3],v[[30]][3],v[[31]][3],v[[32]][3],v[[33]][3],v[[34]][3],v[[35]][3],v[[36]][3],
v[[37]][3],v[[38]][3],v[[39]][3],v[[40]][3],v[[41]][3],v[[42]][3],v[[43]][3],v[[44]][3],v[[45]][3],
v[[46]][3],v[[47]][3],v[[48]][3],v[[49]][3],v[[50]][3],v[[51]][3],v[[52]][3],v[[54]][3],v[[55]][3],
v[[56]][3],v[[57]][3],v[[58]][3],v[[59]][3],v[[60]][3],v[[61]][3],v[[62]][3],v[[63]][3],v[[64]][3],
v[[65]][3],v[[66]][3],v[[67]][3],v[[68]][3],v[[69]][3],v[[70]][3],v[[71]][3],v[[72]][3],v[[73]][3],
v[[74]][3],v[[75]][3],v[[76]][3],v[[77]][3],v[[78]][3],v[[79]][3],v[[80]][3],v[[81]][3],v[[82]][3],
v[[83]][3],v[[84]][3],v[[85]][3],v[[86]][3],v[[87]][3],v[[88]][3],v[[89]][3],v[[90]][3],v[[91]][3],
v[[92]][3],v[[93]][3],v[[94]][3],v[[95]][3],v[[96]][3],v[[97]][3],v[[98]][3],v[[99]][3],v[[100]][3])

w1<-max(w,na.rm=FALSE)
list<-c(list,w1)

This runs but it does not pick out the max of the vector nor does it add it to 
the list.The for loop shuffles the vector then iterates 50 times and there 
should be 50 values in the list.I created the list outside the for loop with 
list<-NULL.When I look at the list I get the whole vector 50 times(5000 values) 
so I assume that max is not picking out the maximum value of the vector 
everytime through the loop.
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.

Reply via email to