It is not a good idea to use "sample' when building an
example like this! Running the code does not give the
example dataframe.
This is crude but it will do what you want.
x <- " Z Y X
1 4 Yes
2 1 No
3 2 Perhaps
4 3 Yes
5 4 No
6 5 No
7 1 Ye
Karin Lagesen wrote:
> I am sorry if this is a faq or tutorial somewhere, but I am unable to
> solve this one.
>
> What I am looking for is a count of how many different
> categories(numbers in this case) that appears for a given factor.
>
> Example:
>
>
>> l <- c("Yes", "No", "Perhaps")
>> x <-
I am sorry if this is a faq or tutorial somewhere, but I am unable to
solve this one.
What I am looking for is a count of how many different
categories(numbers in this case) that appears for a given factor.
Example:
> l <- c("Yes", "No", "Perhaps")
> x <- factor( sample(l, 10, replace=T), level
3 matches
Mail list logo