The if function should go somewhat like this:

If the p value is smaller than 0,05 test the skewness. If the skewness is less than -0,5 the distribution is shifted into the right and print a histogram of it. If the skewness is higher than >0.5, the distribution is shifted into the left, print a histogram. If the skewness is between 0,5 and -0,5 the distribution is aproximately simetrical. Else, the distribution is normal.

After running my code, nothing happens. Has somebody suggestion what might be wrong? Has anyone a better solution for this code?

Code:

```
library("moments")
library("ggplot2")
histogram <- qplot(data, binwidth = 1.0, geom = "histogram", xlab = "my data",
ylab = "data frequency",
y = ..density.., fill = I("salmon"), colour = I("black")) +
stat_density(geom = "line")
normality <- shapiro.test(data)
skew <- skewness(data)
if(normality$p.value<0.05){
if(skew< -0.5){
"The distribution is shifted into the right"
histogram
}
if(skew> 0.5){
"The distribution is shifted into the left"
histogram
}
if(skew<=0.5 && skew>=-0.5){
"The distribution is simetrical"
return()
}
else{
"The distribution is normal"
histogram
}
}
```