Giter VIP home page Giter VIP logo

cohorts's People

Contributors

peerchristensen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cohorts's Issues

Release cohorts 1.1.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::build_readme()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted ๐ŸŽ‰
  • Add preemptive link to blog post in pkgdown news menu
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)
  • Finish blog post
  • Tweet

Years as a cohort interval

Thank you for creating the cohorts package! I was looking for something to help me analyze donor retention across years and this package and explanation was far and away the simplest thing I found.

However, I wanted to look at years rather than months, so I created a new function with very minor changes that uses lubridate instead of zoo:

cohort_table_year <- function(df, id_var, date)
{
  dt <- dtplyr::lazy_dt(df)
  dt %>% dplyr::rename(id = {
    {
      id_var
    }
  }) %>% dplyr::group_by(id) %>% dplyr::mutate(year = lubridate::year({
    {
      date
    }
  })) %>% dplyr::mutate(cohort = min(year)) %>% dplyr::group_by(cohort,
                                                                 year) %>% dplyr::summarise(users = dplyr::n_distinct(id)) %>%
    tidyr::pivot_wider(names_from = year, values_from = users) %>%
    dplyr::ungroup() %>% dplyr::mutate(cohort = 1:dplyr::n_distinct(cohort)) %>%
    tibble::as_tibble()
}

Feel free to add this (and/or rewrite with zoo instead).

change from counting n to n_distinct(var_id)

@PeerChristensen many thanks for this package. I used it for one of my analysis. One thing I found out in the source code is that the values being calculated seem to be a count of the rows (n) and not n_distinct(var_id). I believe to get the no of users we need to count the distinct user_ids ?

i.e. instead of
dplyr::summarise(users = dplyr::n()) %>%

we have

dplyr::summarise(users = dplyr::n_distinct({{ id_var }})) %>%

How can I get historical data?

A great job with the package. It makes pulling Twitch data pretty simple.
I do have one request, being able to pull down historical data (i.e not just the current month) would be really useful.

TX
David

cohorts converted to data.table/tidytable....

Hello Peer,

Thanks for your package. I find it very useful and convenient.

Since I am using a large customer base, the process to get the monthly or the daily cohorts take a little while, so I converted your code to data.table (and a little bit of tidytable) and I see already an improvement. Even for the small dataset you include online_cohorts in the package I see an improvement of 2x.

If you are interested, I can send to you the code to extend your package with them.

Thanks,
Carlos.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.