Hello,
Hosack, Michael wrote:
Hello,
I need to create a dataframe containing all possible combinations of
three variables: SITE (101,102,103,104), WDAY (MON,TUE,WED,THR,FRI),
and TOD (MORN, AFTN). There should be a total of 40 unique
combinations in my dataframe. I used expand.grid() successful
Hi Mike,
the following works for me:
SITE <- ordered(c(101,102,103,104))
WDAY <-
ordered(c("MON","TUE","WED","THR","FRI"),levels=c("MON","TUE","WED","THR","FRI"))
TOD <- ordered(c("MORN","AFTN"),levels=c("MORN","AFTN"))
foo <- expand.grid(SITE=SITE,WDAY=WDAY,TOD=TOD)
foo[order(foo$SITE),]
If
On 26/03/2010, at 9:22 AM, Hosack, Michael wrote:
> Hello,
>
> I need to create a dataframe containing all possible combinations of
> three variables: SITE (101,102,103,104), WDAY (MON,TUE,WED,THR,FRI),
> and TOD (MORN, AFTN). There should be a total of 40 unique combinations
> in my dataframe.
Hi Mike,
Try this:
SITE <- c(101,102,103,104)
WDAY <- c('MON','TUE','WED','THR','FRI')
TOD <- c('MORN', 'AFTN')
out <- expand.grid(SITE, WDAY, TOD)
out
HTH,
Jorge
On Thu, Mar 25, 2010 at 4:21 PM, Hosack, Michael <> wrote:
> Hello,
>
> I need to create a dataframe containing all possible combi
4 matches
Mail list logo