R getting share of users with multiple of an element

I have a data frame like this

User     OS
A        Windows
A        Linux
B        MacOS
C        Linux
C        FreeBSD
C        Windows
D        Windows


What I want to do is plot two types of statistics.

1. The share of users with different number of OSs. So, it would be the fraction of the users with 1 OS, with OS etc.
2. The share of users with only one OS and more than one OS.

For this I tried using tapply(OS, User, unique). But don't know how to go about plotting the results.

I was wondering if this is the right way and what more would I need to do to to get the plots I wanted.

-
 if it's really about programming in R, there are quite some plot people on stackoverflow.com that can help you out as well. – Joris Meys Nov 26 '10 at 16:20

You could try something like

> df <- data.frame(User=sample(LETTERS[1:10], 100, rep=T),
OS=sample(c("Win","Lin","Mac"), 100, rep=T))
> (res <- with(df, tapply(OS, User, function(x) length(unique(x)))))
A B C D E F G H I J
2 3 3 3 3 3 3 3 3 3
> barplot(table(res)) # for counts
> barplot(table(ifelse(res==1, "1", "2+")))


Replace table() by prop.table() if you want proportions instead of counts, as suggested by @Chase in a comment to your preceding question.

-