Question

Suppose you have a categorical variable X with nine categories: A, B, C, D, E, F, G, H and I. The frequencies corresponding t
0 0
Add a comment Improve this question Transcribed image text
Answer #1

We can create our first data set by combining two variables one and two

# Create variables

one=c('A','B','C','D','E','F','G','H','I')
two=c(25,12,7,4,6,2,1,0,2)

#Join the variables to create a data frame

d <- data.frame(one,two)
d

output:

 one two
1   A  25
2   B  12
3   C   7
4   D   4
5   E   6
6   F   2
7   G   1
8   H   0
9   I   2

single bar will perform a vector operation.

both2 = d$two[(d$one=='A') | (d$one=='B')|(d$one=='C') | (d$one=='D')|(d$one=='E') | (d$one=='F')|(d$one=='G') | (d$one=='H')|(d$one=='I')]
y=both2
y

output:

[1] 25 12 7 4 6 2 1 0 2

Add a comment
Know the answer?
Add Answer to:
Suppose you have a categorical variable X with nine categories: A, B, C, D, E, F, G, H and I. The frequencies corre...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT