Hi Rock,
If I understand correctly, if budget
is NA
, you want to change the value of screens
to 0. Have you considered using case_when
inside of mutate
?:
library(tidyverse)
moviedata <- moviedata %>%
mutate(screens = case_when(
is.na(budget) ~ 0,
TRUE ~ screens
))
Created on 2018-10-01 by the reprex package (v0.2.0).
If this isn't what you're looking for, can you please share a reprex (reproducible example)? This will ensure we're all looking at the same data and code. A guide for creating a reprex can be found here.