Skip to content
Back to formatted view

Raw Message

Message-ID: <DDFA2EE1-2FAE-419A-B348-DD8B316F9432@micromata.de>
Date: 2012-10-09T12:29:36Z
From: Jessica Streicher
Subject: other way of making a table?

I'm making tables for prediction results of classifiers (2 classes) that show the usual numbers, true positives, false positives, etc

I used the command

table(predictedLabels,realLabels)

to make those.

I just had a case though ,where one of the label vectors had only one class in it. This will result in only half a table.

Compare:
x<-c(1,1,1,0,0)
y<-c(1,1,1,0,1)
table(x,y)

to 

x<-c(1,1,1,0,0)
y<-c(1,1,1,1,1)
table(x,y)

I want the second one to still have all 4 cases (second column all zeros then).

Any easy solutions?