From Thorn.Thaler at rdls.nestle.com  Thu Jan  6 15:37:01 2011
From: Thorn.Thaler at rdls.nestle.com (Thaler, Thorn, LAUSANNE,
	Applied Mathematics)
Date: Thu, 6 Jan 2011 15:37:01 +0100
Subject: [Rd] Minimum of an ordered factor
In-Reply-To: <19749.37073.506112.61897@fangorn.hornik.net>
References: <F54EF8F1B477CF448729593FE421F6464A22AE@HQVEVE0032.nestle.com><19748.36291.498450.670163@lynne.math.ethz.ch>
	<19749.37073.506112.61897@fangorn.hornik.net>
Message-ID: <F54EF8F1B477CF448729593FE421F6464A2377@HQVEVE0032.nestle.com>

Kurt Hornik writes
> >> if (!all(sapply(args, is.ordered)) ||
> >> !all(sapply(level.list, identical, y = level.set))) {
> 
> I think it would be better to use something like
> 
>   ll <- lapply(args, levels)
> 
>   !all(sapply(ll, identical, ll[[1L]]))
> 
> [using union() is not quite right]

Yes definitely. This line is in fact just a relic from a previous idea I
had.
 
> The general comment is that if we support this I don't see why we
> should
> not also support c.ordered (and in fact also c.factor) with the same
> restrictions (identical level sequences for ordered and level sets for
> factors).  We already have Ops.factor and Ops.ordered using the same
> principle afaic.
> 
> If we add c.ordered, we should be able to encapsulate the identity of
> levels testing into this, and simply use
> 
>     x <- c(...)
> 
> and then call .Generic on the codes of x etc.

Sounds reasonable. Ack.

BR Thorn



[Rd] Minimum of an ordered factor
Thorn.Thaler at rdls.nestle.com (Thaler, Thorn, LAUSANNE,