Using R I want to create a table showing member weekday rides and causal week day rides

I have df with 3 million rows. I want to group by member_casual, convert the date to day of the week and get a count of observations (frequency) for each day of the week grouped by member.

 member_casual  date
 member         11/12/2021
 member         11/13/2021
 casual         10/15/2021
 member          9/3/2021
 casual          6/23/2021
 ...             ...

I want a df or table that will output like this

  member        Sunday     114999
                Monday     145987
                Tuesday    89433
                ...
  casual        Sunday     18448
                Monday     111748
                ...

I can get the individual, member or casual, but not group in one df/table.

df_daym <- filter( df, member_casual == "member" )

df_daym <- count( weekdays((as.Date(df_daym$started_at))))
df_daym

Which produces this just for the member

x.       freq

Friday    307671            
Monday    268096            
Saturday  324283            
Sunday    266256            
Thursday  301321            
Tuesday   285632            
Wednesday 306113    

I want to combine them into one output.



from Recent Questions - Stack Overflow https://ift.tt/3esJCEn
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Network Error and Timeout on Authorize.net JS

Spring Elasticsearch Operations