Re: [R] recursive relevel

2009-01-09 Thread baptiste auguie
nner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] Namens baptiste auguie

Re: [R] recursive relevel

2009-01-09 Thread ONKELINX, Thierry
te is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project

Re: [R] recursive relevel

2009-01-09 Thread baptiste auguie
On 9 Jan 2009, at 15:26, Dimitris Rizopoulos wrote: I think that you can still use to core of stats:::relevel.factor; the only thing that needs to be changed is the controls for bad values of the 'ref' argument, i.e., relevelNew <- function (x, ref, ...) { lev <- levels(x) if (is.chara

Re: [R] recursive relevel

2009-01-09 Thread Dimitris Rizopoulos
I think that you can still use to core of stats:::relevel.factor; the only thing that needs to be changed is the controls for bad values of the 'ref' argument, i.e., relevelNew <- function (x, ref, ...) { lev <- levels(x) if (is.character(ref)) ref <- match(ref, lev) if (any

[R] recursive relevel

2009-01-09 Thread baptiste auguie
Dear list, I'm having second thoughts after solving a very trivial problem: I want to extend the relevel() function to reorder an arbitrary number of levels of a factor in one go. I could not find a trivial way of using the code obtained by getS3method("relevel","factor"). Instead, I thou