knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

mminer

The mminer package is a simple wrapper for Marketing Miner Profilers API. Currently it provides functions to fetch search volume data only. Fetched data are cached locally in a file and used to save credits when necessary.

Installation

You can install the development version of mminer from GitHub with:

# install.packages("devtools")
devtools::install_github("MarekProkop/mminer")

After instalation (important)

You have to get your own API key for Marketing Miner Profilers API first. Then save the key in an environment variable named 'MARKETING_MINER_API_KEY'. If you don't do that, you will have to provide your API key in the api_key argument of all function calls.

Examples

To get search volume data for a single search query:

library(mminer)
get_volume_data("seo", lang = "cs")

To get search volume data for multiple search queries:

queries <- c("seo", "seo optimalizace", "seo company")
get_volume_data(queries, lang = "cs")

To retrieve data from cache:

get_volume_cache()

To calculate costs:

queries <- c("seo", "seo optimalizace", "seo company", "seo specialista")
get_volume_cost(queries)

To delete the cache file:

delete_volume_cache()

About caching

By default the cache is a file (rds) in the mminer-cache folder, which is automaticaly created in the current working folder. The folder itself is not removed by the delete_volume_cache() function.

You can change the cache folder by the cache_path argument, e.g.:

get_volume_data("seo", lang = "cs", cache_path = tempdir())

Now the default cache dosen't exist:

get_volume_cost("seo")

But in tempdir() it does:

get_volume_cost("seo", cache_path = tempdir())
delete_volume_cache(tempdir())


MarekProkop/mminer documentation built on June 14, 2022, 12:41 a.m.