find_product: Find product terms

Description Usage Arguments Details Value Examples

View source: R/find_product.R

Description

Find columns in a data frame or matrix that are the products of two or more other columns.

Usage

1
2
3

Arguments

data

The data frame to be searched.

target

The column to be checked if it is a product of other columns.

expand

Whether the function will attempt to expand a lower order term to their components. Default is TRUE.

Details

This function find probable product terms by comparing its values to the products of other columns. It was developed for identifying columns that are the products of two columns. It may be able to identify columns that are the products of three or more columns but there is no guarantee.

Value

find_all_products returns a named list. For each element, the name is the column name of a product term, and the content is a vector of the names of the columns used for form the product term. If no column is a product of other column, it returns a names list of zero length.

find_product returns a vector of two elements. If the target column is a product of two other columns, this vector contains the names of these two columsn. Otherwise, this is a vector of NAs.

Examples

1
2
3
4
## Not run: 
# To be prepared

## End(Not run)

sfcheung/plotmodsem documentation built on Dec. 23, 2021, 12:21 a.m.