matched_inner: Do a batch of inner products on a data frame

Description Usage Arguments Value Examples

View source: R/matched_inner.R

Description

Do a batch of inner products on a data frame

Usage

1
matched_inner(df_weights, df_target)

Arguments

df_weights

inner product weights

df_target

target data frame

Value

data frame with inner product results

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
df_weights <-
  tribble(
    ~out_name, ~X2, ~X1,
         "Y1",   1,  -1,
         "Y2",   0,  -1
  )

df_target <-
 tibble(
   X1 = c( 0, 1, 2, 3),
   X2 = c( 0, 0, 1, 1),
   X3 = c( 5, 6, 7, 8)
 )

matched_inner(df_weights, df_target)

bind_cols(
  df_target,
  matched_inner(df_weights, df_target)
)

zdelrosario/piMat documentation built on Jan. 2, 2020, 12:03 p.m.