Hi, I made a sample dataset,
Here's an example dataset
data.frame(
Item1 = c(3, 4, 4, 6, 7),
Item2 = c(6, 7, 7, 8, 5),
Item3 = c(5, 4, 3, 5, 7),
Item4 = c(3, 8, 9, 8, 7),
Item5 = c(4, 5, 6, 3, 2),
Item6 = c(7, 8, 6, 5, 8)
)
In this set, items 1, 3, and 5 would be subscale 1 and items 2, 4, and 6 would be subscale 2.
I need to find the averages for both subscales, and preferably make them into two separate columns.
I do not have a code error - because I just can't find a code to use.
I tried averaging like this:
> mean(mydata$Item1$mydata$Item3$mydata$Item5)
Error in mydata$Item1$ : $ operator is invalid for atomic vectors
But that definitely doesn't work.
Is there anything else I can do to help or mak this clearer?