7 Linii poligonale

glimpse(weather)
## Rows: 26,115
## Columns: 15
## $ origin     <chr> "EWR", "EWR", "EWR", "EWR", "EWR", "EWR", "EWR", "EWR", "EW…
## $ year       <int> 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013,…
## $ month      <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
## $ day        <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
## $ hour       <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, …
## $ temp       <dbl> 39.02, 39.02, 39.02, 39.92, 39.02, 37.94, 39.02, 39.92, 39.…
## $ dewp       <dbl> 26.06, 26.96, 28.04, 28.04, 28.04, 28.04, 28.04, 28.04, 28.…
## $ humid      <dbl> 59.37, 61.63, 64.43, 62.21, 64.43, 67.21, 64.43, 62.21, 62.…
## $ wind_dir   <dbl> 270, 250, 240, 250, 260, 240, 240, 250, 260, 260, 260, 330,…
## $ wind_speed <dbl> 10.35702, 8.05546, 11.50780, 12.65858, 12.65858, 11.50780, …
## $ wind_gust  <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 20.…
## $ precip     <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
## $ pressure   <dbl> 1012.0, 1012.3, 1012.5, 1012.2, 1011.9, 1012.4, 1012.2, 101…
## $ visib      <dbl> 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,…
## $ time_hour  <dttm> 2013-01-01 01:00:00, 2013-01-01 02:00:00, 2013-01-01 03:00…
ianuarie <- weather[weather$month==1 & weather$day<=15, ]
ggplot(data=ianuarie, aes(x=time_hour, y= temp))+
  geom_line()
ggplot(data=ianuarie, aes(x=time_hour, y= temp))+
  geom_line(aes(color=origin))
ggplot(data=ianuarie, aes(x=time_hour, y= temp))+
  geom_line(aes(linetype=origin))
ggplot(data=ianuarie, aes(x=time_hour, y= temp))+
  geom_line(linetype='twodash')
ggplot(data=ianuarie, aes(x=time_hour, y= temp))+
  geom_line(color='red', size=0.5, linetype='twodash')
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
ggplot(data=ianuarie, aes(x=time_hour, y= temp))+
  geom_line(aes(color=origin))+
  theme(legend.position = 'top')

variable de tip data calendaristica

datasiora <- ianuarie$time_hour[1:10]
datasiora
##  [1] "2013-01-01 01:00:00 EST" "2013-01-01 02:00:00 EST"
##  [3] "2013-01-01 03:00:00 EST" "2013-01-01 04:00:00 EST"
##  [5] "2013-01-01 05:00:00 EST" "2013-01-01 06:00:00 EST"
##  [7] "2013-01-01 07:00:00 EST" "2013-01-01 08:00:00 EST"
##  [9] "2013-01-01 09:00:00 EST" "2013-01-01 10:00:00 EST"
unclass(datasiora)
##  [1] 1357020000 1357023600 1357027200 1357030800 1357034400 1357038000
##  [7] 1357041600 1357045200 1357048800 1357052400
## attr(,"tzone")
## [1] "America/New_York"

anul

format(datasiora,"%Y")
##  [1] "2013" "2013" "2013" "2013" "2013" "2013" "2013" "2013" "2013" "2013"

luna

format(datasiora,"%m")
##  [1] "01" "01" "01" "01" "01" "01" "01" "01" "01" "01"

ziua

format(datasiora,"%d")
##  [1] "01" "01" "01" "01" "01" "01" "01" "01" "01" "01"

ora

format(datasiora,"%H")
##  [1] "01" "02" "03" "04" "05" "06" "07" "08" "09" "10"

minute

format(datasiora,"%M")
##  [1] "00" "00" "00" "00" "00" "00" "00" "00" "00" "00"