Hi, Recently I was told by users of some of the function I wrote that they experience crashes in places where logical vector was passed to sum function. However on my computer those functions work just fine. After closer look at documentation of function 'sum', I realized that it is defined only for complex and numeric vectors, so I guess I was using "undocumented feature".
What I am trying to understand is why it works on some systems (my - Win XP, from R-1.9.? to R-2.2.0) and does not work on other (unknown platform, R-2.2.0): - Is it that they have more methods of function "sum" defined and some other function (maybe some package has "logical.sum" defined) is being used? - Different operating systems will have different behavior for supporting "undocumented features"? Is there any way to automatically test your code for presence of unsupported functions it uses? Should function 'sum' produced warning/error, or convert logical to integer? An Example code: repeats = function(x) return (sum(duplicated(x)) ) # how many numbers repeat themselves in vector x? repeats( c(1:10, 3:14) ) Jarek ====================================================\==== Jarek Tuszynski, PhD. o / \ Science Applications International Corporation <\__,| (703) 676-4192 "> \ [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
