relate {dlookr}R Documentation

Relationship between target variable and variable of interest

Description

The relationship between the target variable and the variable of interest (predictor) is briefly analyzed.

Usage

relate(.data, predictor)

## S3 method for class 'target_df'
relate(.data, predictor)

Arguments

.data

a target_df.

predictor

variable of interest. predictor.

See vignette("relate") for an introduction to these concepts.

Details

Returns the four types of results that correspond to the combination of the target variable and the data type of the variable of interest.

Value

An object of the class as relate. Attributes of relate class is as follows.

Descriptive statistic information

The information derived from the numerical data describe is as follows.

See Also

print.relate, plot.relate.

Examples


# If the target variable is a categorical variable
categ <- target_by(heartfailure, death_event)

# If the variable of interest is a numerical variable
cat_num <- relate(categ, sodium)
cat_num
summary(cat_num)

plot(cat_num)

# If the variable of interest is a categorical variable
cat_cat <- relate(categ, hblood_pressure)
cat_cat
summary(cat_cat)
 
plot(cat_cat)

##---------------------------------------------------
# If the target variable is a numerical variable
num <- target_by(heartfailure, creatinine)

# If the variable of interest is a numerical variable
num_num <- relate(num, sodium)
num_num
summary(num_num)

plot(num_num)

# If the variable of interest is a categorical variable
num_cat <- relate(num, smoking)
num_cat
summary(num_cat)

plot(num_cat)

# Not allow typographic
plot(num_cat, typographic = FALSE)



[Package dlookr version 0.6.3 Index]