Re: [R] discrete variable

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Sun, 02 Mar 2008 17:42:56 -0300

See

> length(unique(x))
[1] 6

> table(x)

On 02/03/2008, Pete Dorothy <croero_at_gmail.com> wrote:
> Hello,
>
> I am sorry for asking such a basic question. I could not find an answer to
> it using google.
>
> I have a discrete variable (a vector x) taking for example the following
> values : 0, 3, 4, 3, 15, 5, 6, 5
>
> Is it possible to know how many different values (modalities) it takes ?
> Here it takes 6 different values but the length of the vector is 8.
>
> I would like to know if there is a way to get the set of the
> modalities {0,3,4,15,5,6} with the number of times each one is taken
> {1,2,1,1,2,1}
>
> Thank you very much
>

> P.S. : is there some useful functions for discrete variables ?
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 02 Mar 2008 - 20:52:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 02 Mar 2008 - 21:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive