Question: Say we want to create a new variable in worldecon that has a value of 2 when the GDP variable is above the median and

Say we want to create a new variable in worldecon that has a value of 2 when the GDP variable is above the median and a value of 1 when the value is below the median. We want this new variable to be called gdpBin, which of the following pieces of code would achieve this objective (assume that there are no NAs)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!