Message Boards Message Boards

0
|
4235 Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

Generating a dummy variable

Posted 10 years ago
POSTED BY: Florian Bannwart
6 Replies

It worked perfectly, thank you very much Gianluca!

POSTED BY: Florian Bannwart
POSTED BY: Gianluca Gorni
POSTED BY: Florian Bannwart

What is the format of your matrix? Is it a list of lists? Can you give a small sample?

POSTED BY: Gianluca Gorni

Thanks for your reply. However, how do I apply this code?

i.e. if i name my dataset "data", do I just type

data[{{1, 2}, {2, 1}} /. {a?NumericQ, b} :> {a, b, If[a >= b, 1, 0]}]?

Sorry for the weird questions, I'm quite new to this program =)

Thanks!

POSTED BY: Florian Bannwart

Something like this?

{{1, 2}, {2, 1}} /. {a_?NumericQ, b_} :> {a, b, If[a >= b, 1, 0]}
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract