eve1
1
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
Can your provide a reproducible example?
system
Closed
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.