0

sorry for the beginner question in advance. I searched for an answer, but couldn't find a fitting one.

I have over 20 groups of 6 subjects each, all participating in the same study. All groups had the same test conditions and answered a number of items. I want a mean value per Item across all groups, considered for possible effects within the groups. Or does this average out anyway with the number of groups?

It's a data frame with the heading "group" "Item1" "Item2" "Item3" "..."

edit: This question was not answered in the thread above unfortunately

Jinn54
  • 11
  • 1
  • 2
    Can you give some code that demonstrates the shape of your data? Is it a dataframe? A list of some sort? – Chechy Levas Sep 09 '18 at 12:52
  • Oh sorry, I edited my question, though I'm not sure how to insert a data frame correctly. – Jinn54 Sep 09 '18 at 13:23
  • 1
    I can vote for re-open, but please note that you did not provide a reproducible example and the desired output. It is thus difficult to help you. – www Sep 09 '18 at 13:52
  • 2
    Please read [How to make a great R reproducible example?](https://stackoverflow.com/q/5963269/4996248) – John Coleman Sep 09 '18 at 13:55

1 Answers1

2

To give you an example of self contained (reproducible) code, and an answer to what I think is your question:

myData <- data.frame(item1 = runif(n=10), item2 = rnorm(n=10), item3 = rt(n=10, df = 1))

means <- apply(myData, 2, mean)

print(means)

If this does not answer your question, then start by editing the above code to more accurately reflect the shape of your data, and give an example of the output.

Chechy Levas
  • 2,206
  • 1
  • 13
  • 28