library(ggplot2) 
## Warning: пакет 'ggplot2' был собран под R версии 4.3.3
library(tidyr)
## Warning: пакет 'tidyr' был собран под R версии 4.3.3
library(readxl)
## Warning: пакет 'readxl' был собран под R версии 4.3.3
library(tidyverse)
## Warning: пакет 'tidyverse' был собран под R версии 4.3.3
## Warning: пакет 'readr' был собран под R версии 4.3.3
## Warning: пакет 'forcats' был собран под R версии 4.3.3
## Warning: пакет 'lubridate' был собран под R версии 4.3.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ lubridate 1.9.3     ✔ tibble    3.2.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
dat <- data.frame(deň = c("Po", "Ut", "St", "Št", "Pi"), 
                  meranie = c(23, 20, 18, 26, 20),
                  predpoveď = c(20, 18, 16, 23, 21)
)


clean_dat <- dat%>%
  pivot_longer(cols = c(meranie, predpoveď),
               names_to = "Type",
               values_to = "Temperature")
clean_dat
## # A tibble: 10 × 3
##    deň   Type      Temperature
##    <chr> <chr>           <dbl>
##  1 Po    meranie            23
##  2 Po    predpoveď          20
##  3 Ut    meranie            20
##  4 Ut    predpoveď          18
##  5 St    meranie            18
##  6 St    predpoveď          16
##  7 Št    meranie            26
##  8 Št    predpoveď          23
##  9 Pi    meranie            20
## 10 Pi    predpoveď          21
p1<- ggplot(clean_dat, aes(x = deň,y=Temperature,color=Type))+geom_point()
p1

iris_data <- read_excel("Rk/iris.xlsx")
## New names:
## • `` -> `...2`
## • `` -> `...3`
## • `` -> `...4`
## • `` -> `...5`
iris_data <- iris_data %>% select(-contains("NA"))


names(iris_data) <- c("Species", "Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")


iris_clean <- iris_data %>%
  pivot_longer(cols = -Species,
               names_to = "Measurement",
               values_to = "value") %>%
  mutate(value = as.numeric(value))
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `value = as.numeric(value)`.
## Caused by warning:
## ! в результате преобразования созданы NA
ggplot(iris_clean, aes(x = value, y = Species, color = Species, shape = Measurement)) +
  geom_point(size = 3) +
  labs(x = "Význam", y = "Zobrazenie Iris", color = "Zobrazenie dúhovky ", shape = "Meranie")
## Warning: Removed 8 rows containing missing values or values outside the scale range
## (`geom_point()`).