X argument "false" is missing, with no default

Buenas,

Intento correr un if_else pero sin embargo me arroja un error con el valor false que no entiendo.

Desde ya muchas gracias.

ejemplo <- data.frame(
stringsAsFactors = FALSE,
ANO4 = c(“2008”,
“2008”,“2008”,“2008”,“2008”,“2008”,“2008”,
“2008”,“2008”,“2008”),
CH04 = c(“Varon”,
“Varon”,“Varon”,“Varon”,“Mujer”,“Varon”,
“Mujer”,“Varon”,“Mujer”,“Varon”),
EP = c(“CuentaPropia\nNoProf”,“PEA.registrado.\nno.EP”,
“PEA.registrado.\nno.EP”,“PEA.registrado.\nno.EP”,
“PEA.no.registrado.\nno.EP”,
“PEA.desocup.no.EP”,“PEA.registrado.\nno.EP”,
“PEA.registrado.\nno.EP”,“PEA.registrado.\nno.EP”,
“PEA.registrado.\nno.EP”),
PONDERA = c(1495,
1134,1163,1337,1337,1330,1330,1760,1760,
1235)
)
serie_nucleo_08_20 <- ejemplo %>%
filter(EP == “CuentaPropia\nNoProf”) %>%
group_by(ANO4,CH04) %>%
summarise(Individuos = if_else(ANO4 == “2016”, true = sum(PONDERA)/3),false = (sum(PONDERA)/4))

Error: Problem with summarise() column Individuos.
i Individuos = if_else(ANO4 == "2016", true = sum(PONDERA)/3).
x argument “false” is missing, with no default

Separa esto en dos pasos

library(tidyverse)

ejemplo <- data.frame(
    stringsAsFactors = FALSE,
    ANO4 = c("2008",
              "2008","2008","2008","2008","2008","2008",
              "2008","2008","2008"),
    CH04 = c("Varon",
              "Varon","Varon","Varon","Mujer","Varon",
              "Mujer","Varon","Mujer","Varon"),
    EP = c("CuentaPropia\nNoProf","PEA.registrado.\nno.EP",
            "PEA.registrado.\nno.EP","PEA.registrado.\nno.EP",
            "PEA.no.registrado.\nno.EP",
            "PEA.desocup.no.EP","PEA.registrado.\nno.EP",
            "PEA.registrado.\nno.EP","PEA.registrado.\nno.EP",
            "PEA.registrado.\nno.EP"),
    PONDERA = c(1495,
                1134,1163,1337,1337,1330,1330,1760,1760,
                1235)
)

ejemplo %>%
    filter(EP == "CuentaPropia\nNoProf") %>%
    group_by(ANO4,CH04) %>%
    summarise(Individuos = sum(PONDERA)) %>% 
    mutate(Individuos = if_else(ANO4 == "2016", true = Individuos/3,false = Individuos/4))
#> `summarise()` has grouped output by 'ANO4'. You can override using the `.groups` argument.
#> # A tibble: 1 x 3
#> # Groups:   ANO4 [1]
#>   ANO4  CH04  Individuos
#>   <chr> <chr>      <dbl>
#> 1 2008  Varon       374.

Created on 2021-07-20 by the reprex package (v2.0.0)