######################## CVICENI 1 ###########################
### 1 ###
## a
ID <- round(rnorm(100, mean = 1700, sd = 50), digits = 0)
ID

## b
LOCATION <- as.factor(sample(LETTERS[5:8], 100, replace=TRUE))
LOCATION
# LOCATION <- factor(sample(LETTERS[5:8], 100, replace=TRUE))


## C
HODNOTY <- matrix(round(runif(1000,30,38), digits = 2),100, 10)
HODNOTY

### 2 ###
LOCATION <- as.vector(LOCATION); LOCATION
HUMERUS <- as.data.frame(cbind(ID, LOCATION, HODNOTY))
HUMERUS
HUMERUS <- data.frame(ID, LOCATION, HODNOTY)

### 3 ###
jmeno <- c("Lenka", "Polcerová")
nchar(jmeno)
matrix(NA, nrow = 5, ncol = 9)

### 4 ###
DATA <- read.csv("zkusebni_data.csv", sep=";", header = TRUE)
attach(DATA)
str(DATA)
## a
head(DATA,4)
tail(DATA,4)

## b
dim(DATA)

## c
summary(DATA)
library(pastecs)
stat.desc(DATA[dx.sin=="sin",])
# note: pro CI.mean R vygeneruje NaN - nedostatecne mnozstvi dat
stat.desc(DATA[dx.sin=="dx",])
library(psych)
describeBy(DATA, group=DATA[,"dx.sin"])




