knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
mixpanelR provides R interface for MixPanel data export API. More specifically, the package provides an S4 class that can be used to issue:
mixpanelR::request
functionmixpanelR::export
functionThe following sample code exports the full data dump for the specified event into a R data.frame. In this example, all variable names and types are automatically extracted within the export
function so data.frame df
contains the variables with correct names and types.
library(mixpanelR) # Create the S4 object api <- MixPanel( api_key = "<API_KEY>", api_secret = "<API_SECRET>" ) # High-level function: full event data dump into data.frame df <- export(api, event = "project:successful_donation", params = list(from_date = "2015-01-01", to_date = "2015-03-05") ) summary(df) # Low-level function: specific API method requests raw_response <- request(api, methods = list("events"), params = list( event = list("project:successful_donation","project:loaded"), unit = "hour", interval = 24, type = "general" ) ) data <- fromJSON(raw_response)
You can install the package as follows:
if (packageVersion("devtools") < 1.6) { install.packages("devtools") } devtools::install_github("realAkhmed/mixpanelR")
The package passes all CRAN checks and could be submitted to CRAN.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.