hi i need to pass stata's command to r, but i have 0 idea
destring v1, g(aux) dpcomma
replace aux=. if aux==0
egen objetive_var=mean(aux), by(v2)
i tried this
ptje_2020 <- ptje_2020 %>%
mutate(aux=ifelse(df$v1 == 0,NA, df$v1))
ptje_2020 %>%
group_by(v2) %>%
mutate(objetive_var= mean(aux), na.rm=TRUE)
but is no working