0

I have the following code:

df%>%group_by(var1, var2)%>%summarise(mean=mean(var3))

which yields:

        var1       var2  mean
      <fctr>     <fctr> <dbl>
1   Handtuch        INK  3.08
2   Handtuch        KON  3.08
3     Kissen        INK  3.15
4     Kissen        KON  4.46
5   TV-klopf        INK  3.69
6   TV-klopf        KON  3.62
7 TV-streich        INK  2.46
8 TV-streich        KON  3.00

I want to test, whether the difference between the "INK" and "KON" of every similar level in var1 is significant, i.e. is "Handtuch INK" significantly different from "Handtuch KON" and is "Kissen INK" significantly different from "Kissen KON" etc.

Can anybody help me with the right R code? Thank you.

Jens Stach
  • 39
  • 1
  • 8
  • 3
    I think you need to use your dataset before the `summarise` step. Check here for more info https://stats.stackexchange.com/questions/168378/applying-two-sample-t-test-comparing-multiple-groups-in-two-categories – AntoniosK Dec 14 '17 at 14:23
  • What test do you want to perform exactly? There are different tests depending on how you believe the data are generated. If you don't know what statistical test to use, you should probably ask for help at [stats.se]. Once you know what test you want to perform, it will be easier to google how to perform that test in R. – MrFlick Dec 14 '17 at 15:17
  • var3 is a survey question (likert scale 1-7) and is positively skewed, hence I assume a Mann-Whitney test of significance might be appropriate. – Jens Stach Dec 14 '17 at 17:01
  • Thanks for your help AntoniosK, the example you supplied uses a factor with only 2 levels, whereas mine (var1) has four. In this case, your solution does not work. Do you have an alternative idea? – Jens Stach Dec 19 '17 at 16:03

0 Answers0