Skip to content

using tabble

3 messages · Fan Dan, Bernardo Rangel Tura, Jim Lemon

#
On Mon, 2010-01-18 at 17:17 +0800, Fan Dan wrote:
Hi!

If i understood your problem is easy create a fake data for example:

set.seed(123)
x<-rep(sample(1:7,5),3)
table(x)
x
3 4 5 6 7 
3 3 3 3 3

In this example the values "1" and "2" are missing

Solution change your variable to factor and determine your leveal
x.factor<-factor(x,levels=1:7)
table(x.factor)
x
1 2 3 4 5 6 7 
0 0 3 3 3 3 3
#
On 01/18/2010 08:17 PM, Fan Dan wrote:
Mozart, Mozart, what are we to do?

Mozartdat<-c(rep(1,12),rep(2,3),rep(3,45),rep(6,5),rep(7,7))
Mozart.table<-tabulate(Mozartdat)
names(Mozart.table)<-1:7
Mozart.table

Jim