lundi 19 mars 2018

If condition and Mutate to create columns

I am using this code , though I am not getting desired output . Any error here ?

{ {if(rd_3$results.cluster=='Visitor' | rd_3$results.cluster=='Employee') rd_3<- as.data.frame(rd_3 %>% group_by(device_id,hotel,start_date) %>% mutate(visit_no.=cumsum(c(T,diff.Date(start_date) > 0))))} {if(rd_3$results.cluster=='Guest') rd_3<- as.data.frame(rd_3 %>% group_by(device_id,hotel) %>% mutate(visit_no.=cumsum(c(T,diff.Date(start_date) > 1))))}}

Aucun commentaire:

Enregistrer un commentaire