You might look at the function confusion() in the DAAGxtras package.
John Maindonald             email: john.maindonald@anu.edu.au
phone : +61 2 (6125)3473    fax  : +61 2(6125)5549
Centre for Mathematics & Its Applications, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
http://www.maths.anu.edu.au/~johnm
On 09/03/2011, at 10:00 PM, r-help-request@r-project.org wrote:
> From: "Shi, Tao" <shidaxia@yahoo.com>
> Date: 9 March 2011 7:22:49 AM AEDT
> To: r-help@r-project.org
> Subject: [R] confusion matrix
> 
> 
> Hi list,
> 
> Is there already a function somewhere to output the confusion matrix from
two
> input vectors?  "table" always automatically delete rows or
columns with all
> 0's.  For example, I would like the columns for "10" and
"30" added back.
> 
> Thanks!
> 
> ...Tao
> 
> 
> 
>      20 40 50 60 70 80 90 100
>  10   0  0  1  0  0  0  1   0
>  20   1  2  0  4  0  0  0   1
>  30   0  0  0  0  0  0  1   1
>  40   0  0  1  1  2  0  0   0
>  50   0  1  0  0  0  1  0   0
>  60   0  0  0  0  0  0  1   1
>  70   0  0  1  1  1  1  1   1
>  80   0  1  0  0  0  0  0   1
>  90   0  0  0  0  0  0  0   3
>  100  0  0  0  0  1  0  0   3
> 
	[[alternative HTML version deleted]]