podlove_get_and_clean: Fetch and prepare all download data

Description Usage Arguments Value Examples

View source: R/podlove_get_and_clean.R

Description

podlove_get_and_clean opens up a connection to a Podlove-enable Wordpress MySQL database, gets all necessary tables, connects and cleans the data and returns it as a data frame. The function uses rstudioapi::askForSecret(), which allows securely storing access info in the local keyring.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
podlove_get_and_clean(
  db_name = rstudioapi::askForSecret(name = "dbname", message =
    "Enter the name of the database", title = "Database Name"),
  db_host = rstudioapi::askForSecret(name = "host", message =
    "Enter the hostname of the database", title = "Hostname"),
  db_user = rstudioapi::askForSecret(name = "user", message =
    "Enter the user name of the database", title = "User Name"),
  db_password = rstudioapi::askForSecret(name = "password", message =
    "Enter the Password", title = "Password"),
  launch_date = NULL,
  ddupe = FALSE,
  tbl_prefix = "wp_",
  tbl_downloads = "podlove_downloadintentclean",
  tbl_mediafile = "podlove_mediafile",
  tbl_useragent = "podlove_useragent",
  tbl_episode = "podlove_episode",
  tbl_posts = "posts"
)

Arguments

db_name

name of the database

db_host

hostname of the database

db_user

username of the database

db_password

password of the database

launch_date

date of the first official podcast episode release

ddupe

boolean switcher for legacy deduplication. Don't use this until you know what you're doing.

tbl_prefix

prefix of the MySLQ table names, defaults to 'wp_'

tbl_downloads

name of the MySQL table for clean downloads (without the prefix)

tbl_mediafile

name of the MySQL table for mediafiles (without the prefix)

tbl_useragent

name of the MySQL table for useragents (without the prefix)

tbl_episode

name of the MySQL table for episodes (without the prefix)

tbl_posts

name of the MySQL table for posts (without the prefix)

Value

a dataframe containing all episode download attempts

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# will ask for db name, host, username, password
dlic_raw <- podlove_get_and_clean(launchdate = "2019-05-01")

## End(Not run)
## Not run: 
# don't use clear access data in functions, never save passwords to .R files! 
download_data <- podlove_get_and_clean(dbname = "my_sql_database",
                                       host = "my.database.host",
                                       user = "username,"
                                       password = "my.secret.password",
                                       launchdate = "2019-05-01")

## End(Not run)

lordyo/podlover documentation built on Feb. 20, 2020, 5:58 p.m.