MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to Do a Replacement with Two Conditions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119702] Re: How to Do a Replacement with Two Conditions
  • From: Peter Breitfeld <phbrf at t-online.de>
  • Date: Fri, 17 Jun 2011 06:09:12 -0400 (EDT)
  • References: <itejv3$s36$1@smc.vnet.net>

Gregory Lypny wrote:

You may use Unitize

ll = {52, 5, 235, 256, 259, 4, 64, 233, 92, 201, 180}
Unitize[ll, 180]
Unitize[ll, 181]

> Hello everyone,
>
> I have a list of integers and I want to replace numbers bigger than 180 with one and those less than or equal to 180 with 0 to create a dummy variable.  The ones are easy:
>
> 	myList /. x_ /; x > 180 -> 1
>
> How do I get the zeros in there?
>
> Regards,
>
> Gregory
>

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de


  • Prev by Date: Re: How to Do a Replacement with Two Conditions
  • Next by Date: unable to run factor.exe
  • Previous by thread: Re: How to Do a Replacement with Two Conditions
  • Next by thread: Re: How to Do a Replacement with Two Conditions