How to Do a Replacement with Two Conditions
- To: mathgroup at smc.vnet.net
- Subject: [mg119673] How to Do a Replacement with Two Conditions
- From: Gregory Lypny <gregory.lypny at videotron.ca>
- Date: Fri, 17 Jun 2011 00:07:58 -0400 (EDT)
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
- Follow-Ups:
- Re: How to Do a Replacement with Two Conditions
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Re: How to Do a Replacement with Two Conditions
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: How to Do a Replacement with Two Conditions
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Re: How to Do a Replacement with Two Conditions
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Re: How to Do a Replacement with Two Conditions
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Re: How to Do a Replacement with Two Conditions
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: How to Do a Replacement with Two Conditions
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: How to Do a Replacement with Two Conditions
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Re: How to Do a Replacement with Two Conditions
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Re: How to Do a Replacement with Two Conditions
- From: Heike Gramberg <heike.gramberg@gmail.com>
- Re: How to Do a Replacement with Two Conditions