[R] simple question with table()

2008-11-30 Thread Simone Gabbriellini
Dear List, my problem should be easy to fix, but I couldn't find a solution by myself... In my survey, there is a question with 14 possible answers. None of the respondents choose the 13th answer, so when I table() the results, R says: 1 2 3 4 5 6 7

Re: [R] simple question with table()

2008-11-30 Thread Berwin A Turlach
G'day Simone, On Sun, 30 Nov 2008 11:05:13 +0100 Simone Gabbriellini [EMAIL PROTECTED] wrote: my problem should be easy to fix, but I couldn't find a solution by myself... In my survey, there is a question with 14 possible answers. None of the respondents choose the 13th answer, so

Re: [R] simple question with table()

2008-11-30 Thread Chuck Cleland
On 11/30/2008 5:05 AM, Simone Gabbriellini wrote: Dear List, my problem should be easy to fix, but I couldn't find a solution by myself... In my survey, there is a question with 14 possible answers. None of the respondents choose the 13th answer, so when I table() the results, R says:

Re: [R] simple question with table()

2008-11-30 Thread Jorge Ivan Velez
Dear Simone, Try this: x=c(1,1,2,3,4,3,2,2,2,1,2,3,4,4,3) table(factor(x,levels=1:5)) 1 2 3 4 5 3 5 4 3 0 HTH, Jorge On Sun, Nov 30, 2008 at 5:05 AM, Simone Gabbriellini [EMAIL PROTECTED] wrote: Dear List, my problem should be easy to fix, but I couldn't find a solution by myself...

Re: [R] simple question with table()

2008-11-30 Thread Dimitris Rizopoulos
you have to use a factor, e.g., x - sample((1:14)[-13], 100, TRUE) f - factor(x, levels = 1:14) table(f) I hope it helps. Best, Dimitris Simone Gabbriellini wrote: Dear List, my problem should be easy to fix, but I couldn't find a solution by myself... In my survey, there is a question