Q: Function to discretize a variable based on a selected...

Description Usage Arguments Value Examples

View source: R/Q.R

Description

Function to discretize a variable based on a selected quantile

Usage

1
Q(x, q)

Arguments

x

variable to discretize

q

probability corresponding to quantile

Value

vector with a discretized version of x.

Examples

1
2
3
4
5
 x <- runif(100,-1,1)
 y <- x^2 + rnorm(100)
 
 summary( lm(y ~ Q(x,0.25) ) )
 summary( lm(y ~ Q(x,0.75) ) )

sumtxt/datatools documentation built on Jan. 3, 2021, 1:39 a.m.