aj: As of join

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/aj.R

Description

The functions aj joins tables along columns that are usually time columns.

Usage

1
aj(by, x, y)

Arguments

by

A vector of character representing the keys on which to perform the join. last element is typically time.

x

A dataframe

y

A dataframe to lookup value in.

Details

aj(c(c1,...,cn),t1,t2) where (c1,...,cn) is a list of common column names, and t1 and t2 are the tables to be joined. The columns need not be keys on t1, and t2 must not have a key. Moreover common columns in t1 and t2 must be of the same type and cn (last sym in common columns) must be a common column, typically time, although aj can work on any other type if sorted.

The result is a table with records from the left join of t1 and t2.

For each record in t1, the result has one record with the items in t1, and if there are matching records in t2, the items of the last (in row order) matching record are appended to those of t1 if there is no matching record in t2, the remaining columns are null

Value

A dataframe with values of y as of x taken on specified keys.

Author(s)

JFP

See Also

lj and uj

Examples

1
2
3
4
5
6
7
8
 x <- data.frame(time=c("10:01:01","10:01:03", "10:01:04"),
                  sym=c("msft", "ibm", "ge"),
                  qty=c(100,200,150))
  y <- data.frame(time=c("10:01:00", "10:01:00", "10:01:00", "10:01:02"),
                  sym=c("ibm", "msft", "msft", "ibm"),
                  px=c(100,99,101,98))
  by <- c("sym", "time")
  aj(by, x, y)

HikaGenji/fql documentation built on April 12, 2021, 8:36 a.m.