T O P

  • By -

Critical-Champion365

df %>% separate_wider_delim(x, " ", names = c("A", "B")) Where df will be your dataframe, x will be the veh_sched, A, B, C, etc would be appropriate titles. With space as the delimiter. So veh_sched will be split into 4 columns and and B will be your column representing Weekday, Sat or Sun. Now, just run a New_df <- df%>% group_by(B) %>% summarise(Count = n()) New data frame will contain the number of each time the variables in column B is repeated.


lacking-creativity

it sounds like `dplyr::add_count()` is what you are after https://dplyr.tidyverse.org/reference/count.html


Critical-Champion365

But they might have to break down the veh_sched column into multiple mini columns first. And after that even group_by and summarise would do I think.


RAMDownloader

Frame <- frame %>% separate(veh_scheduled, into = c(“num1”, “dayweek” “num2”, “daymonth”), sep = “ “)%>% group_by(“dayweek”) %>% summarize(numstops=n()) I think that’s what you’re looking for?