Re: [R] what is the purpose of an error message in uniroot?

2007-02-01 Thread Chris Andrews
Matt, Some time back I didn't like the uniroot restriction either so I wrote a short function manyroots that breaks an interval into many shorter intervals and looks for a single root in each of them. This function is NOT guaranteed to find all roots in an interval even if you specify many

Re: [R] Switching labels on a factor

2006-12-18 Thread Chris Andrews
Bob, This is I think exactly what one wants to have happen. The first four observations are still women. Both the labels and the underlying integers should change. (If you want to give all the people sex changes, try Relevel in the Epi package. mydata$afterthechange -

[R] Biobass, SAGx, and Jonckheere-Terpstra test

2006-06-30 Thread Chris Andrews
Horace, Last year I found another Jonckheere-Terpstra function at http://www.biostat.wustl.edu/archives/html/s-news/2000-10/msg00126.html Using that and the version in SAGx and wanting a few other options, I created the version below. Hope it is useful, Chris -- Christopher Andrews, PhD SUNY

Re: [R] Finding all possible partitions of N units into k classes

2005-12-09 Thread Chris Andrews
nkpartitions - function(n, k, exact=FALSE, print=FALSE) { # n objects # k subgroups # exactly k or at most k? # print results as they are found? if (n != floor(n) | n=0) stop(n must be positive integer) if (k != floor(k) | k=0) stop(k must be positive integer) if (print) {