Learn R Programming

poplite (version 0.99.23)

External methods: Specific methods for generics defined in external packages.

Description

These functions provide convienient interfaces to functionality provided in external packages (currently only dplyr). See the vignette and below examples.

Usage

filter(.data, …, .preserve = FALSE)
select(.data, …,.tables=NULL)

Arguments

.data

A Database object.

.tables

A character vector indicating the table(s) the specified columns refer to.

.preserve

Currently ignored.

For filter, a single valid R expression which would result in a logical vector upon execution. For select, expression indicating the columns to choose from the given table(s). See the examples in dplyr::filter and dplyr::select. In addition, the names of the tables can be prepended to each variable name similar to SQL statements (e.g. 'table.column').

Value

An object of class tbl_sqlite.

See Also

filter,select

Examples

Run this code
# NOT RUN {
  if (require(Lahman))
  {
      baseball.teams <- makeSchemaFromData(TeamsFranchises, name="team_franch")
      baseball.teams <- append(baseball.teams, makeSchemaFromData(Teams, name="teams"))
      
      relationship(baseball.teams, from="team_franch", to="teams") <- franchID ~ franchID
      
      baseball.db <- Database(baseball.teams, tempfile())
      
      populate(baseball.db, teams=Teams, team_franch=TeamsFranchises)
      
      select(baseball.db, .tables="teams")
      
      select(baseball.db, .tables=c("teams", "team_franch"))
      
      select(baseball.db, yearID:WCWin, franchName)
      
      filter(baseball.db, active == "Y")
      
      select(filter(baseball.db, active == "Y" & W > 50 & teamID == "CAL"), active, W, teamID)
  }
# }

Run the code above in your browser using DataLab