Question



Can you clarify the following statement: Compute the the sum by both ID1 and ID2 ? -HW1 Exercise4 (due 2/1)-

Hello Dr. Ballings,

For exercise 4, where you ask us to "Compute the sum by both ID1 and ID2," are you asking us to compute the sum of the variable V2 by both
ID1 and ID2?

For example:

We know that:

ID1=c(1,1,1,1,2,2,2)

ID2=c(1,1,3,3,1,4,4)

V2=c(1,2,3,4,4,4,4)

where ID1[1]=1 and ID1[2] =1; ID2[1]=1 and ID2[2] =1

and V2[1] = 1 and V2[2] = 2

As a result, the sum of the variable V2 by both ID1 and ID2 is 3.

If this incorrect, could you explain how we should approach this problem?

Shelby





Answers and follow-up questions





Answer or follow-up question 1

Hello Shelby,

This is what you should have:

ID1 ID2 x
1 1 3
2 1 4
1 3 7
2 4 8

Michel Ballings



Sign in to be able to add an answer or mark this question as resolved.