Hi Beter not to give a same name your values (variables) as is function name. R is quite clever and
sample <- rnorm(10) sample <- sample(sample,3) works as expected, but it is not a rule. Cheers Petr On 28 Oct 2004 at 17:54, Kunal Shetty wrote: > Dear R- users and Helpers > > Is there some way to re initialise or clear the array elements? > Pardon me for being vague but the problem itself quite vague. I have > attached the code along with email. When I run the saved r- code using > source("random1.txt") , command. > > The program runs fine..but at times there is an error see below # ; > but again after the error if re-excuted it would work fine?I probably > missed some array detail in my program any suggestions > > #Error in var(parrX[1, ]) : missing observations in cov/cor > > parrX[] is an array . > > 2) Also pardon me for the lengthy procedural code > but as you could see in it..i have used the for loop for > finding the positions (indexes) of the missing values and > later carry out updating the new array element values at those > particular positions/ > So how can I escape the for loop in this case ? i.e get the > missing position indexes and save another object ay vector or > array ? > > And also later wanted to use matrix or vector multiplication > (%*%) for the updating statement > newy[i]<- u2 + covXY/varX * (sample$x[i] - u1) > > is any of the apply function good out here ? > > I really feel that I am doing something very routine and donkey work > and I am most certain that powerful R ? functions could just execute > the same 10 liner for loop condition to mere 4 lines ? but how?I am > getting lost in the sea of functions here? > > Thank u for reading > Regards > Kunal > Petr Pikal [EMAIL PROTECTED] ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html