s-news
[Top] [All Lists]

Re: count occurrences

To: <Ita.Cirovic-Donev@hypo-alpe-adria.com>
Subject: Re: count occurrences
From: "Dimitris Rizopoulos" <dimitris.rizopoulos@med.kuleuven.be>
Date: Mon, 20 Nov 2006 15:18:39 +0100
Cc: <s-news@lists.biostat.wustl.edu>
References: <OF37967DBD.A1CF9C2B-ONC125722C.004D11E7-C125722C.004DD87C@arz.co.at>
try this then:

x <- sample(LETTERS, 1100, TRUE)
y <- sample(0:1, 1100, TRUE)

#########

ind <- as.logical(y)
table(x) # all
table(x[ind]) # ones
table(x[!ind]) # zeros


Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
    http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- From: <Ita.Cirovic-Donev@hypo-alpe-adria.com>
To: <s-news@lists.biostat.wustl.edu>
Sent: Monday, November 20, 2006 3:10 PM
Subject: [S] count occurrences






Sorry, I have an addition to previous email. I also have a vector of zeros and ones of equal length as the first vector. The counting should be done
in the following way:

     count each A where it is equal to zero
     count each A where it is equal to one
     and so on for the rest of the qualitative marks.

thanks



--------

Hi,

I have a vector with qualitative values such as A,B,C,D,E,F,G. The length of the column is 1100. I would like to go through the vector an count the occurrences of A, B,C and so on and record the values in the new vector. Is there a function that does a counting in this way that I can insert into
the for loop. Thanks.





Razmjena informacija s HYPO ALPE-ADRIA-BANK d.d. putem e-maila je bez jamstava. Zakljucivanje pravnih poslova putem ovog medija nije dozvoljeno. Ovaj e-mail moze sadrzavati povjerljive i/ili povlastene informacije. Ako ste ga primili greskom, molimo Vas da nas o tome odmah obavijestite tako sto cete na njega odgovoriti, a zatim vas molimo da ga izbrisete iz vaseg
sustava. Ovime vas obavjestavamo da je svako otkrivanje, kopiranje,
distribuiranje ili poduzimanje bilo kakvih aktivnosti u vezi s njegovim
sadrzajem strogo zabranjeno i moze biti nezakonito.



The exchange of messages with HYPO ALPE-ADRIA-BANK d.d. via e-mail is not binding. Declarations regarding legal transactions must not be exchanged
via this medium. The information contained in this e-mail message is
confidential and intended exclusively for the addressee. Persons receiving this e-mail message who are not the named addressee (or his/her co-workers, or persons authorized to take delivery) must not use, forward or reproduce its contents. If you have received this e-mail message by mistake, please contact us immediately and delete this email message beyond retrieval.

--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


<Prev in Thread] Current Thread [Next in Thread>