[R] Do we have similar function to Minitab's INDICATOR?

Thomas Lumley thomas at biostat.washington.edu
Fri Dec 22 18:18:14 CET 2000


On Fri, 22 Dec 2000, C. Joseph Lu wrote:

> Dear R-Friends,
> 
> Do we have a similar R function to work like Minitab's INDICATOR?

You can do it with

outer(C2,sort(unique(C2)),function(i,j) as.numeric(i=j))

and model.matrix also does something similar.


	-thomas


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list