Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cro

Creates a minimal representation of a data frame.


Description

Given a data frame with a defined response variable, this function creates a unique representation of the covariates in the data frame, vector (matrix) of responses, and a pointer vector, connecting the responses with the corresponding covariates.

Usage

cro(dat, response = 1)

Arguments

dat

A data frame

response

The column(s) where the response resides.

Details

The rows in the data frame are converted to text strings with paste and compared with match.

Value

A list with components

y

The response.

covar

A data frame with unique rows of covariates.

keys

Pointers from y to covar, connecting each response with its covariate vector.

Note

This function is based on suggestions by Anne York and Brian Ripley.

Author(s)

Göran Broström

See Also

Examples

dat <- data.frame(y = c(1.1, 2.3, 0.7), x1 = c(1, 0, 1), x2 = c(0, 1, 0))
cro(dat)

eha

Event History Analysis

v2.10.0
GPL (>= 2)
Authors
Göran Broström [aut, cre], Jianming Jin [ctb]
Initial release
2022-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.