Apologies for not using reprex but i am getting and error message
*"Error in get_result(output = out, options) : *
- callr subprocess failed: could not start R, exited with non-zero status, has crashed or was killed"*
How do I use arguments within pipes
#Apply certain functions conditionally without leaving the pipe-flow
Liberties taken with a previous examples posted here
hairdo <- tribble(~ hair, ~length,
"Longish Hair", "Little Long",
"Short Hair ", "Short",
"Bob", "Very Short",
"Weave", "Long",
"Long Hair", "Long",
"Longer Hair", "Very Long",
" Another Bob", "Short")
hairdo$hair %>% str_replace_all("Long","XX") #works
hairdo <- hairdo %>% mutate(colour = ifelse(grepl("Long.", hair),"Blond", "Brunette")) ##works
hairdo <- hairdo %>% mutate(colour = ifelse(hair == ("Long."),"Blond", "Brunette")) # does not work
hairdo$hair %>% str_to_lower() %>% str_squish() %>% if_else(str_detect("long"), "Blond", "Brunette") # does not work
hairdo %>% mutate(colour = case_when(hair %in% ("Long.") ~ "Blond", "Brunette")) # does not work
hairdo %>% {if ( (hairdo$hair %in% "Long.") == TRUE) filter(.,"Blond") else "Brunette"} # does not work
Where am I going wrong?