{"id":13857719,"url":"https://github.com/y-bar/mmetrics","last_synced_at":"2026-04-04T14:34:33.459Z","repository":{"id":69020860,"uuid":"187179304","full_name":"y-bar/mmetrics","owner":"y-bar","description":"Easy computation of Marketing Metrics in R","archived":false,"fork":false,"pushed_at":"2019-08-14T06:57:45.000Z","size":224,"stargazers_count":28,"open_issues_count":6,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-07-13T08:56:50.854Z","etag":null,"topics":["marketing","marketing-analytics","marketing-tools","r"],"latest_commit_sha":null,"homepage":"https://y-bar.github.io/mmetrics/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/y-bar.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-05-17T08:37:34.000Z","updated_at":"2025-05-25T04:09:19.000Z","dependencies_parsed_at":"2023-03-04T11:45:19.517Z","dependency_job_id":null,"html_url":"https://github.com/y-bar/mmetrics","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/y-bar/mmetrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-bar%2Fmmetrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-bar%2Fmmetrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-bar%2Fmmetrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-bar%2Fmmetrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/y-bar","download_url":"https://codeload.github.com/y-bar/mmetrics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/y-bar%2Fmmetrics/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265218200,"owners_count":23729496,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["marketing","marketing-analytics","marketing-tools","r"],"created_at":"2024-08-05T03:01:45.080Z","updated_at":"2026-04-04T14:34:33.449Z","avatar_url":"https://github.com/y-bar.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n)\noptions(knitr.table.format = 'markdown')\n```\n\n# mmetrics \u003ca href='https://y-bar.github.io/mmetrics/'\u003e\u003cimg src='man/figures/logo.png' align=\"right\" height=\"139\" /\u003e\u003c/a\u003e\n\n[![Travis-CI Build Status](https://api.travis-ci.com/y-bar/mmetrics.svg?branch=master)](https://travis-ci.com/y-bar/mmetrics) \n[![Build status](https://ci.appveyor.com/api/projects/status/99up72xw1eoj8s3i/branch/master?svg=true)](https://ci.appveyor.com/project/teramonagi/mmetrics/branch/master)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/mmetrics)](https://cran.r-project.org/package=mmetrics)\n[![codecov](https://codecov.io/github/y-bar/mmetrics/branch/master/graphs/badge.svg)](https://codecov.io/github/y-bar/mmetrics) \n[![Licence](https://img.shields.io/cran/l/mmetrics.svg)](https://github.com/y-bar/mmetrics/blob/master/LICENSE)\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n\n\nEasy Computation of Marketing Metrics with Different Analysis Axis.\n\n## Installation\n\nYou can install the released version of {mmetrics} from CRAN with:\n\n```r\ninstall.packages(\"mmetrics\")\n```\n\nOr install the development version from github with:\n\n```r\n# install.packages(\"remotes\")\nremotes::install_github(\"y-bar/mmetrics\")\n```\n\n## Example\n### Load Dummy data\nFirst, we load dummy data from {mmetrics} package for this example.\n```{r}\ndf \u003c- mmetrics::dummy_data\ndf\n```\n\n### Define metrics\nAs a next step, we define metrics to evaluate using `mmetrics::define`. \n```{r}\n# Example metrics\nmetrics \u003c- mmetrics::define(\n  cost = sum(cost),\n  ctr  = sum(click)/sum(impression) # CTR, Click Through Rate \n)\n```\n\n### Just call `mmetrics::add()` !\nCall `mmetrics::add()` with grouping key (here `gender`) then we will get new `data.frame` with defined metrics.\n```{r}\nmmetrics::add(df, gender, metrics = metrics)\n```\n\n### Remove aggregate function from metrics using `mmetrics::disaggregate()`\nIt is hassle for users to re-define metrics when you would like to use these for `dplyr::mutate()`.\nIn this case, you can use `mmetrics::disaggregate()` to remove *the first aggregation function* for the argument and return disaggregated metrics.\n\n```{r}\n# Original metrics. sum() is used for this metrics\nmetrics\n```\n\n```{r}\n# Disaggregate metrics!\nmetrics_disaggregated \u003c- mmetrics::disaggregate(metrics)\n# Woo! sum() are removed!!!\nmetrics_disaggregated\n```\n\nYou can use these metrics with `dplyr::mutate()` for row-wise metrics computation.\n```{r}\ndplyr::mutate(df, !!!metrics_disaggregated)\n```\n\n...or, you can do the same compucation using `mmetrics::gmutate()` defind in our package.\nIn this case, you do not need to write `!!!` (bang-bang-bang) operator explicitly.\n```{r}\nmmetrics::gmutate(df, metrics = metrics_disaggregated)\n```\n\n## More examples\n\n- As a first step, see the vignettes [Introduction to {mmetrics} package](https://y-bar.github.io/mmetrics/articles/introduction.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-bar%2Fmmetrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fy-bar%2Fmmetrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fy-bar%2Fmmetrics/lists"}