Skip to content

AW: [R] constructing specially ordered factor

5 messages · Khamenia, Valery, Brian Ripley, Nassar +2 more

#
Hi Dimitris,

thank you for your reply,
your solution is really shorter, but has two issues to be 
meant here:

1. "unique.default" is applied twice, what might 
   be a bit expensive for strings.

2. your solution brings an implicit prerequisit on 
  "unique.default". Indeed, "unique.default" should 
  preserve the same order for output both working 
  with strings and with numbers. In other words, 
  correspondence must be kept by "unique.default".
  If "unique.default" implementation uses (or will use) 
  lexicographic strings sorting for acceleration
  then this approach fails.


--
Valery
#
On Mon, 4 Oct 2004, Khamenia, Valery wrote:

            
Please follow the posting guide and do your homework before posting, in 
this case the help page for unique.default.

     'unique' returns a vector, data frame or array like 'x' but with
     duplicate  elements removed.

Value:

     An object of the same type of 'x'. but if an element is equal to
     one with a smaller index, it is removed.

so the order is preserved, by definition.

BTW it uses hashing for `acceleration', not something as slow as sorting.
#
Hi all


I'd like to create a grey palette for a filled.contour()
from blank (smallest values) to black (large values)

TiA
Naji
#
At 11:09 AM 10/04/2004, you wrote:
I have used somethig like this with bar plots:

colvec <- gray(sqrt(seq(from=0.05, to=1.0, length=ncolor)))

That will save a color palette in colvec for use in your call.

MHP
#
On Monday 04 October 2004 20:04, Mike Prager wrote:
Another option is the package "RColorBrewer":
BTW: If you start a new thread, please do not reply to an another email with a 
different subject/thread. This confuses email clients and web archives (see  
https://stat.ethz.ch/pipermail/r-help/2004-October/thread.html#57024)

Best wishes,
Arne