ounad=read.table("http://www.tlu.ee/~jaagup/andmed/muu/ounad/antoonovka3.txt", header=TRUE, sep=",")
  head(ounad)
##   august september oktoober
## 1    6.0       7.9      8.7
## 2    4.0       5.7      6.5
## 3    5.2       6.6      6.9
## 4    4.1       5.4      6.8
## 5    5.7       7.9      9.2
## 6    4.2       5.9      7.0
  plot(ounad$august, ounad$september)

  cor(ounad$august, ounad$september)
## [1] 0.892967
  cor.test(ounad$august, ounad$september)
## 
##  Pearson's product-moment correlation
## 
## data:  ounad$august and ounad$september
## t = 19.639, df = 98, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.8447060 0.9268248
## sample estimates:
##      cor 
## 0.892967
  plot(ounad$august, ounad$oktoober)

  cor(ounad$august, ounad$oktoober)
## [1] 0.8549478
  cor.test(ounad$august, ounad$oktoober)
## 
##  Pearson's product-moment correlation
## 
## data:  ounad$august and ounad$oktoober
## t = 16.316, df = 98, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.7914328 0.9001981
## sample estimates:
##       cor 
## 0.8549478
  #arvutage ja joonistage korrelatsioon 
  #septembri ja oktoobri diameetrite vahel
  plot(ounad$september, ounad$oktoober)
  abline(lm(ounad$oktoober~ounad$september))

  cor(ounad$september, ounad$oktoober)
## [1] 0.9132255
  cor.test(ounad$september, ounad$oktoober)
## 
##  Pearson's product-moment correlation
## 
## data:  ounad$september and ounad$oktoober
## t = 22.188, df = 98, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.8734886 0.9408751
## sample estimates:
##       cor 
## 0.9132255
  #Kuvage augustis 5 sentimeetrist suurema diameetriga õunte
  #korrelatsioon oktoobri andmetega
  #lisage ka seosele vastav joon
  suured=ounad[ounad$august>5, ]
  plot(suured$august, suured$oktoober)

  cor(suured$august, suured$oktoober)
## [1] 0.4828939
  cor.test(suured$august, suured$oktoober)
## 
##  Pearson's product-moment correlation
## 
## data:  suured$august and suured$oktoober
## t = 3.4438, df = 39, p-value = 0.001385
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2058207 0.6882902
## sample estimates:
##       cor 
## 0.4828939
  elekter=read.table("http://www.tlu.ee/~jaagup/andmed/elekter/hinnad_2014_eur_alg.txt", header=TRUE, sep=",")
 #Kuu eraldamise näide
 head(elekter)
##        Date     Hours   SYS   SE1   SE2   SE3   SE4    FI   DK1   DK2
## 1 1/01/2014 00Ā -Ā 01 28.53 28.67 28.67 28.67 28.67 28.67 15.15 15.15
## 2 1/01/2014 01Ā -Ā 02 28.01 28.08 28.08 28.08 28.08 28.08 12.96 12.96
## 3 1/01/2014 02Ā -Ā 03 27.16 27.38 27.38 27.38 27.38 27.38 12.09 12.09
## 4 1/01/2014 03Ā -Ā 04 26.05 26.21 26.21 26.21 26.21 26.21 11.70 11.70
## 5 1/01/2014 04Ā -Ā 05 25.16 25.98 25.98 25.98 25.98 25.98 11.66 11.66
## 6 1/01/2014 05Ā -Ā 06 25.58 26.38 26.38 26.38 26.38 26.38 11.35 11.35
##    Oslo Kr.sand Bergen Molde Tr.heim Tromso    EE    LV    LT
## 1 29.07   29.07  29.07 28.67   28.67  28.67 28.67 32.06 32.06
## 2 28.81   28.81  28.81 28.08   28.08  28.08 28.08 32.02 32.02
## 3 28.42   28.42  28.42 27.38   27.38  27.38 27.38 27.38 27.38
## 4 27.63   27.63  27.63 26.21   26.21  26.21 26.21 26.21 26.21
## 5 25.98   25.98  25.98 25.98   25.98  25.98 25.98 25.98 25.98
## 6 26.38   26.38  26.38 26.38   26.38  26.38 26.38 26.38 26.38
  strsplit("1/01/2014", "/")
## [[1]]
## [1] "1"    "01"   "2014"
  strsplit("1/01/2014", "/")[[1]][2]
## [1] "01"
  kuu=unlist(lapply(strsplit(as.character(elekter$Date), "/"), function(vastus){vastus[2]}))
  aprill=elekter[kuu=="04", ]
  head(aprill)
##           Date     Hours   SYS   SE1   SE2   SE3   SE4    FI   DK1   DK2
## 2161 1/04/2014 00Ā -Ā 01 27.08 27.89 27.89 27.89 27.89 27.89 27.89 27.89
## 2162 1/04/2014 01Ā -Ā 02 26.89 27.23 27.23 27.23 27.23 27.23 27.23 27.23
## 2163 1/04/2014 02Ā -Ā 03 26.81 26.99 26.99 26.99 26.99 26.99 26.99 26.99
## 2164 1/04/2014 03Ā -Ā 04 26.88 27.22 27.22 27.22 27.22 27.22 27.22 27.22
## 2165 1/04/2014 04Ā -Ā 05 27.14 28.02 28.02 28.02 28.02 28.02 28.02 28.02
## 2166 1/04/2014 05Ā -Ā 06 28.93 30.03 30.03 30.03 30.03 30.97 30.03 30.03
##       Oslo Kr.sand Bergen Molde Tr.heim Tromso    EE    LV    LT
## 2161 26.81   26.81  26.81 27.89   27.89  27.89 27.89 43.78 43.78
## 2162 26.76   26.76  26.76 27.23   27.23  27.23 27.23 43.74 43.74
## 2163 26.74   26.74  26.74 26.99   26.99  26.99 26.99 43.74 43.74
## 2164 26.75   26.75  26.75 27.22   27.22  27.22 27.22 43.74 43.74
## 2165 26.80   26.80  26.80 28.02   28.02  28.02 28.02 28.09 28.09
## 2166 26.76   26.76  26.76 30.03   30.03  30.03 30.97 43.92 43.92