Skip to content

How to get the proportions of data with respect to two variables in R?

1 message · Bert Gunter

#
1. A nice example of why posting a small reproducible example would
help get you a useful reply. Your wordy description may not suffice.

2. You are requested not to post in HTML. This is a mailing list, not
a web application.

3. table(class$'Vehicle width') is not a function; it is a table
object returned by the table() function. You need to spend some
additional effort learning R (lots of good tutorials out there and
there's the Intro to R doc that shipes with R) so that you understand
the difference. It clearly matters, no?

4. A stab at an answer (**untested in the absence of data**):

Create a new variable, call it size, via:

b <- within(b,size <- paste0(length, width) ) ## Use simpler names to
avoid quotes
## Size is your unique model identifier -- maybe. Then

with(b,table(ID,class,size))

## should get you close, I think.

Others may have better insight if this is not what you're after.
Again, a small example  would probably be helpful.
Use data.frame() or dput() to include data in a post -- do NOT just
type the data in. See the posting guide for details.

Cheers,
Bert
On Sat, Nov 30, 2013 at 8:11 PM, umair durrani <umairdurrani at outlook.com> wrote: