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
First, the condition
if (is.na(sample$x[i]== TRUE))
asks if sample$x[i] is equal to TRUE, and then checks whether the result of
this comparison is NA. Because the comparison returns NA when one or the
other argument is NA, this works, but note that it would work as well with
FALSE in place of
Replace your line that updates A with this:
p - unique(c(i,j,1:5))
f - function(x) diag( matrix(x,4,4) )
AA - apply( outer(A,G/B), p[-(1:2)], f ) # form product
A - aperm( array( AA, dim(A) ), order(p) ) # reshape
Here are a couple of tests. You might want to do some
more tests yourself as