podatki <- read.table("./Film.csv", 
                      header=TRUE, 
                      sep=";", 
                      dec=",")

head(podatki)
##   Spol Film Vsecnost
## 1    1    1       47
## 2    1    1       38
## 3    1    1       41
## 4    1    1       35
## 5    1    1       43
## 6    1    1       49

Opis spremenljivk:

podatki$SpolFaktor <- factor(podatki$Spol, 
                             levels = c(1, 2), 
                             labels = c("M", "Z"))

podatki$FilmFaktor <- factor(podatki$Film, 
                             levels = c(1, 2), 
                             labels = c("The Notebook", "Dokumentarec"))

str(podatki)
## 'data.frame':    40 obs. of  5 variables:
##  $ Spol      : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Film      : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Vsecnost  : int  47 38 41 35 43 49 38 39 44 48 ...
##  $ SpolFaktor: Factor w/ 2 levels "M","Z": 1 1 1 1 1 1 1 1 1 1 ...
##  $ FilmFaktor: Factor w/ 2 levels "The Notebook",..: 1 1 1 1 1 1 1 1 1 1 ...

Histogram

hist(podatki$Vsecnost, 
     main = "Porazdelitev spr. všečnost filma", 
     ylab = "Frekvenca", 
     xlab = "Všečnost filma", 
     breaks = seq(0, 50, 5), 
     right = FALSE)

library(ggplot2)
ggplot(podatki, aes(x = Vsecnost)) +
  
  geom_histogram(binwidth = 5, colour = "green4", fill= "pink3") +
  
  ylab("Frekvenca")+ 
  facet_wrap(~FilmFaktor, ncol = 1) 

library(ggplot2)
ggplot(podatki, aes(x = Vsecnost, fill = SpolFaktor)) +
  geom_histogram(position=position_dodge(2), binwidth = 5, colour = "gray") +
  facet_wrap(~FilmFaktor, ncol = 1) + 
  ylab("Frekvenca") +
  labs(fill = "Spol")

library(ggplot2)
ggplot(podatki, aes(x = Vsecnost)) +
  theme_bw() +
  geom_histogram(binwidth = 5, colour = "gray") +
  facet_wrap(~SpolFaktor:FilmFaktor) + 
  ylab("Frekvenca") +
  labs(fill = "Spol")
## Ignoring unknown labels:
## • fill : "Spol"

ggplot(podatki, aes(x = FilmFaktor, y = Vsecnost)) +
  geom_boxplot() +
  xlab("Film")

ggplot(podatki, aes(x = FilmFaktor, y = Vsecnost, fill = SpolFaktor)) +
  geom_boxplot() +
  scale_fill_brewer(palette = "Blues") + 
  xlab("Ogledan film") + 
  labs(fill = "Spol")