Tipul de data factor
x <- c('m','f','f','f','m','n')
x
## [1] "m" "f" "f" "f" "m" "n"
## [1] "m" "f" "f" "f" "m" "n"
## [1] m f f f m n
## Levels: f m n
## [1] FALSE
## [1] TRUE
x_factor_nivele <- factor(x, levels=c('m','f','n','t'))
x_factor_nivele
## [1] m f f f m n
## Levels: m f n t
## [1] "f" "m" "n"
## [1] "m" "f" "n" "t"
## [1] m f f f m n
## Levels: f m n
## [1] m f f f m n
## Levels: m f n t
inaltime=c(143,156,163,147)
greutate=c(45,51,56,46)
gen=c('m','n','m','f')
tabel$gen_f <- factor(tabel$gen)
x <- c(10,20,20,10,20,10,10,10)
x
## [1] 10 20 20 10 20 10 10 10
x_factor <- factor(x, labels=c('zece','douazeci'))
x_factor
## [1] zece douazeci douazeci zece douazeci zece zece zece
## Levels: zece douazeci
## [1] 10 20 20 10 20 10 10 10
x_factor <- factor(x, labels=c('douazeci', 'zece'))
x_factor
## [1] douazeci zece zece douazeci zece douazeci douazeci douazeci
## Levels: douazeci zece
## [1] 10 20 20 10 20 10 10 10
x_factor <- factor(x, labels=c('zece','douazeci'))
x_factor
## [1] zece douazeci douazeci zece douazeci zece zece zece
## Levels: zece douazeci
## [1] 10 20 20 10 20 10 10 10
x_factor_ordonat <- ordered(x_factor, levels=c('douazeci','zece'))
plot(x_factor_ordonat)
## Warning: Removed 1 rows containing non-finite values (`stat_boxplot()`).
weather$luna <- factor(weather$month, labels=c('ian','feb','mar','apr','mai','iun','iul','aug','sep','oct','nov','dec'))
## Warning: Removed 1 rows containing non-finite values (`stat_boxplot()`).