s-news
[Top] [All Lists]

Re: Creating more than two level factor

To: Carlos Davidson <cdavidson@csus.edu>, s-news@wubios.wustl.edu
Subject: Re: Creating more than two level factor
From: "Richard M. Heiberger" <rmh@temple.edu>
Date: Tue, 31 Aug 2004 19:40:58 -0400
> fish <- factor(rep(1:2,3), labels=c("fish","nofish"))
> fish
[1] fish   nofish fish   nofish fish   nofish
> depth <- factor(c(1,1,1,2,2,2), labels=c("Deep","Shallow"))
> depth
[1] Deep    Deep    Deep    Shallow Shallow Shallow
> fish.depth <- interaction(fish, depth)
> fish.depth
[1] fish.Deep      nofish.Deep    fish.Deep      nofish.Shallow fish.Shallow  
[6] nofish.Shallow
> 

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Creating more than two level factor, Richard M. Heiberger <=