convertor: Convert a cleaned dataset into a model.matrix

Description Usage Arguments Value Author(s) Examples

View source: R/convertor.R

Description

This function converts a raw dataset into a user defined model.matrix.

Usage

1
convertor(data, response, x.indices)

Arguments

data

A well-cleaned raw data.frame that you would like to convert into a model.matrix as an input for the glmnet package.

response

The column location of y in the dataset.

x.indices

The columns of Xs that you would like to convert into a model.matrix.

Value

a list with elements:

response

the original response

X.model.matrix

the model.matrix for the predictors with the intercept column removed

Author(s)

Mokyo Zhou

Examples

1
2
3
4
data <- data.frame(matrix(rnorm(100*5),100,5))
#Assume y is on the first coordinate
#and the rest are Xs:
model_mat <- convertor(data = data, response = 1, x.indices = seq(2,5))

MokyoZhou/lassoenet documentation built on May 20, 2019, 11:38 a.m.