Last active
October 17, 2017 19:07
-
-
Save chris-prener/ce737d7cfb4c8b1a2ab137c3e89d1349 to your computer and use it in GitHub Desktop.
SOC 4930 & SOC 5050 - Week 08 - Binary Variable for Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
mpg %>% | |
mutate(foreign = ifelse(manufacturer == "audi" | | |
manufacturer == "honda" | | |
manufacturer == "hyundai" | | |
manufacturer == "land rover" | | |
manufacturer == "nissan" | | |
manufacturer == "subaru" | | |
manufacturer == "toyota" | | |
manufacturer == "volkswagen", | |
TRUE, FALSE)) %>% | |
select(manufacturer, model, cty, hwy, foreign) -> autoData |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment