[R] Problem with a if statement inside a function
Carl Witthoft
carl at witthoft.com
Thu Jun 9 18:06:25 CEST 2011
I would start out by checking out ?switch and getting rid of most of
those "if"s .
Next: I apologize for the harshness of this, but your code really does
qualify for http://thedailywtf.com . Creating a zillion variables dXY,
for example, is really poor programming practice. Create a list or
something.
And, this probably should be first: you did not supply an example of
what your input "lst" looks like, AND you didn't tell us what your
expected result is, nor what the "unexpected result" was. At the risk
of speculating wildly, the fact that "lst" is defined inside the
function would suggest there's something fundamentally wrong here.
Carl
More information about the R-help
mailing list