ec_lol_tidy1 {echoice2}R Documentation

Convert "list of lists" format to long "tidy" format

Description

Convert "list of lists" format to long "tidy" format

Usage

ec_lol_tidy1(data_lol, X = "X", y = "y")

Arguments

data_lol

A list of data frames containing design matrices and response vectors

X

The column name of the design matrix, default: "X"

y

The column name of the response vector, default: "y"

Value

A tidy data frame with columns for each design matrix column, the response vector, and an id column indicating which data frame the row came from

Examples


loldata<-list()
loldata[[1]]=list()
loldata[[1]]$y = c(1,2)
loldata[[1]]$X= data.frame(brand1=c(1,0, 1,0),brand2=c(0,1, 0,1),price=c(1,2))
loldata[[2]]=list()
loldata[[2]]$y = c(1,1)
loldata[[2]]$X= data.frame(brand1=c(1,0, 1,0),brand2=c(0,1, 0,1),price=c(1,2))
ec_lol_tidy1(loldata)



[Package echoice2 version 0.2.4 Index]