Skip to content
Back to formatted view

Raw Message

Message-ID: <E27308A9AE9C2C4289FE3F8C16B758141037C8F8@CBMCC-X7-MBX02.ad.cibc.com>
Date: 2011-11-03T17:56:06Z
From: Bond, Stephen
Subject: Create design matrix

Greetings useRs,

What is the easiest way to create a design matrix of several factor variables? Function gendata in Design seems to do that for a fitted model, but how to do that only on several factor vectors??

The result should be a df with one row for each distinct combination of levels of factors eg for (M,F) (Y,O)
We get
M Y
M O
F Y
F O

In reality I will have more than 1000 rows so doing by hand not good.
Maybe there is a way with "outer", but I couldn't see it.
All the best to everybody.

Stephen