lahman

0th

Percentile

Cache and retrieve an

This creates an interesting database using data from the Lahman baseball data source, provided by Sean Lahman at http://www.seanlahman.com/baseball-archive/statistics/, and made easily available in R through the Lahman package by Michael Friendly, Dennis Murphy and Martin Monkman. See the documentation for that package for documentation of the inidividual tables.

Usage
lahman_sqlite(path = NULL)

lahman_postgres(...)

lahman_mysql(...)

lahman_df()

lahman_dt()

lahman_bigquery(...)

has_lahman(type, ...)

lahman_srcs(..., quiet = NULL)

Arguments
path
location to look for and cache SQLite database. If NULL, the default, will first try storing in the installed package directory, and if that isn't writeable, a temporary directory.
...
Arguments passed to src on first load. For mysql and postgresql, the defaults assume you have a local server with lahman database already created. For bigquery, it assumes you have read/write access to a project called Sys.getenv("BIGQUERY_PROJECT")

For lahman_srcs, character vector of names giving srcs to generate.

quiet
if TRUE, suppress messages about databases failing to connect.
type
src type.
Aliases
  • has_lahman
  • lahman
  • lahman_bigquery
  • lahman_df
  • lahman_dt
  • lahman_mysql
  • lahman_postgres
  • lahman_sqlite
  • lahman_srcs
Examples
if (require("RSQLite") && has_lahman("sqlite")) {
  lahman_sqlite()
  batting <- tbl(lahman_sqlite(), "Batting")
  batting
}


# Connect to a local postgres database with lahman database, if available
if (require("RPostgreSQL") && has_lahman("postgres")) {
  lahman_postgres()
  batting <- tbl(lahman_postgres(), "Batting")
}
Documentation reproduced from package dplyr, version 0.1.1, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.