Skip to content
Prev 178019 / 398502 Next

function output with for loop and if statement

On Wed, 2009-04-22 at 16:51 -0400, aaron wells wrote:
Then your function is wrong. But as you haven't provided an example we
can run with data, dummy or otherwise, it is difficult to help. Also
note, that removing the braces around the if(...) block results in a
syntax error so removing them is a non starter.

Call

debug(concov.test)

Then run your function and step through the code checking that it is
doing what you expect at each stage of the analysis. If something is
wrong, fix it. Source the code back into R, set debug() back up and run
again until you have fixed the code so it works as you expect.

This:

if (table(names(tmp.out))[i]==1) {

looks a bit odd. Why are you tabling the names. What is wrong with:

if(names(tmp.out))[i] == 1) {

? If you change that, does it work?

G