[R] Maximum of Maximum

arun smartpink111 at yahoo.com
Fri Jan 10 21:31:46 CET 2014


May be this helps:
 vec1 <- sapply(1:1000,function(x) max(rnorm(1000,0,1)))
 vec2 <- replicate(1000,max(rnorm(1000,0,1)))
#[1] TRUE

res <- sample(vec1,100,replace=FALSE)

#[1] 4.408794

Hello I need some help in programming: 

I want to after take a rnorm(1000,0,1) sample want to save the 
max of it in a vector, this was difficult to me, then I need to repeat 
this process 1000 times, so I shall have 1000 maximum from the normal of
 samples of size 1000. 
Then I want to sample from this maximum series a new sample, this time of size 100. 

I drive a programm: 

for(i in 1:length(sample)){ 

then my result was a vector with n-1 zeroes and the last one 
value was a maximum. I think it took the last value, but I don't know 
how to repair it. 

I need most help, thanks 

More information about the R-help mailing list