---
title: "Uebung_7"
author: "Vitaly Belik"
date: "12/8/2020"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Einstellung zum Trinken

```{r}
df <- read.table("http://belik.userpage.fu-berlin.de/beuth/Attitude.dat", sep = '\t', header = TRUE)
```


```{r}
library(reshape2)
#colnames(df)
longAtt <- melt(df, id.vars = 'participant', measured = c("beerpos","beerneg","beerneut","winepos"  ,"wineneg","wineneut","waterpos","waterneg","waterneu"))
```

```{r}
longAtt$drink<-gl(3, 60, labels = c("Beer", "Wine", "Water"))
longAtt$imagery<-gl(3, 20, 180, labels = c("Positive", "Negative", "Neutral"))
longAtt$groups <- longAtt$variable
longAtt$attitude <- longAtt$value
```


# Haupteffekt von Getränk

```{r}
library(ggplot2)

ggplot(data = longAtt, aes(x = factor(drink), y = attitude)) +
   geom_boxplot() + #geom_jitter()
theme(text = element_text(size = 20))

```

# Haupteffekt von Bild (imagery)

```{r}
library(ggplot2)
ggplot(data = longAtt, aes(x = imagery, y = attitude))+
   geom_boxplot() +
  theme(text = element_text(size = 20))
```

# Haupteffekt von Bild (imagery) aufgeschlüsselt nach Getränk
```{r}
ggplot(data = longAtt, aes(x = imagery, y = attitude, color = drink)) +
   geom_boxplot() +
     theme(text = element_text(size = 20))

```
```{r}
ggplot(data = longAtt, aes(x = imagery, y = attitude, fill = drink)) +
   geom_boxplot() +
     theme(text = element_text(size = 20))

```
```{r}
ggplot(data = longAtt, aes(x = imagery, y = attitude)) +
   geom_boxplot() + facet_wrap(.~drink) + 
     theme(text = element_text(size = 20))

```
```{r}
ggplot(data = longAtt, aes(x = drink, y = attitude, color = drink)) +
   geom_boxplot() + facet_wrap(.~imagery) + 
     theme(text = element_text(size = 20))

```

