1
:R, R R! [email protected]
:
:
: 2015 315,4 .... 480
:
90 !
4
3
5 .
1
1
2
1
1
4
2 -
1
1
: 7 19 [ ]
( )
1)
2)
3)
2014 - 2015
14 * 32615 =456610
R + Rstudio
magrittr (%>%)
tidyr
dplyr , ,
ggplot2
stationaRy
zoo ()
scales
extrafont R
Debian GNU/Linux !
> atmo2 atmo2$time.posCT.Kiev library(extrafont)
Registering fonts with R
> font_import()
Importing fonts may take a few minutes, depending on the number of fonts and the speed of the system. Continue? [y/n] y
Scanning ttf files in /usr/share/fonts/ ...Extracting .afm files from .ttf files......
TeX/LaTeX !
> library(stationaRy)> library(magrittr)> met_stations write.table(met_stations, "met_stations.csv", sep = ";")# . 27 . > KrR_point_met %select_isd_station(name = "LOZUVATKA INTL") %>%get_isd_station_data(startyear = 2005, endyear = 2016)
> KrR_point_met$time.posCT.UTC KrR_point_met$time.posCT.Kiev library(zoo)> KrR_point_met$wd[is.na(KrR_point_met$wd)] seq.time mer.meteo approx.meteo zooToDf = 191.25 & wd < 213.75 & ws > 0), "SSW",ifelse((wd >= 213.75 & wd < 236.25 & ws > 0), "SW",ifelse((wd >= 236.25 & wd < 258.75 & ws > 0), "WSW",ifelse((wd >= 258.75 & wd < 281.25 & ws > 0), "W",ifelse((wd >= 281.25 & wd < 303.75 & ws > 0), "WNW",ifelse((wd >= 303.75 & wd < 326.25 & ws > 0), "NW",ifelse((wd >= 326.25 & wd < 348.75 & ws > 0), "NNW",ifelse((wd >= 348.75 & wd = 0 & wd < 11.25 & ws > 0), "N",ifelse((wd >= 11.25 & wd < 33.75 & ws > 0), "NNE",ifelse((wd >= 33.75 & wd < 56.25 & ws > 0), "NE",ifelse((wd >= 56.25 & wd < 78.75 & ws > 0), "ENE",ifelse((wd >= 78.75 & wd < 101.25 & ws > 0), "E",ifelse((wd >= 101.25 & wd < 123.75 & ws > 0), "ESE",ifelse((wd >= 123.75 & wd < 146.25 & ws > 0), "SE",ifelse((wd >= 146.25 & wd < 168.75 & ws > 0), "SSE",ifelse((wd < 0 & ws > 0), "VRB", "CALM")))))))))))))))))), levels=c("N","NNE","NE","ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW","W", "WNW", "NW", "NNW", "VRB", "CALM"))) -> approx.meteo.df
> atmo2 tbl_df(atmo2) %>%filter(dust != "NA") %>%select(nazva, DD.meteo.from, dust) %>%ggplot(aes(y = dust, x = DD.meteo.from, fill = nazva)) +geom_boxplot() +stat_summary(fun.y = median, geom = "line", aes(group = 2), colour = "red", size = 2) +stat_summary(fun.data = give.n, geom = "text", fun.y = median, angle = 270, size = 3, colour = "slateblue4") +scale_y_continuous(limits=c(0, 0.75)) +
... () + # 20
facet_grid(.~nazva)
:
ggplot2: geom_boxplot
():
ggplot2: geom_tile
> tbl_df(KrR_point_met) %>%... ( : dplyr tidyr http://www.datastory.org.ua/?p=598) %>%ggplot(aes(monthweek, weekday.order, fill = mean.tmp.value)) +geom_tile(colour = "gray15") +facet_grid(year~month.order) +scale_fill_gradient2(name = "...", limits = c(0.0, 100.0), low = "red4", mid = "orange2", high = "royalblue", midpoint = 50.0) +scale_x_continuous(breaks=seq(1, 6, 1)) +
... () + # 20
geom_text(aes(label = mean.tmp.value), vjust = 0.5, family = "Droid Sans", size = 2.5, colour = "darkred")
():
ggplot2: geom_tile
( ):
ggplot2: geom_tile
:
ggplot2 + scales: geom_point + scale_x_datetime
> tbl_df(atmo2) %>%... ( : dplyr tidyr) %>%ggplot(aes(time.posCT.Kiev, NO)) +geom_point(stat="identity", colour = "darkred", size = 3.5) +geom_hline(aes(yintercept = c(0.4, 0.06), colour = c("blue", "green")), linetype=c("dashed", "dotdash"), size = 1.2, show_guide = TRUE) +labs(y = "...", x = "...", title = "...") +scale_color_manual(values=c("#00008B", "#458B00"), name="...",labels=c("...", "...")) +scale_x_datetime(breaks = date_breaks("2880 mins"), labels = date_format("%d %b %H:%M", tz = "Europe/Kiev"), minor_breaks = date_breaks("720 min")) +... () # 20
:
ggplot2 + scales: geom_point + scale_x_datetime
: ... '' ''...
:
ggplot2
> ggplot(aes(x = ..., y = ...)) +geom_point(...) +labs(y = "...", x = "...", title = "...") +theme(text = element_text(family = "Droid Serif", face = "italic", size = 14, colour = "firebrick4", lineheight = 0.9), legend.position = "bottom", legend.text = element_text(family = "Droid Serif", face = "italic", size = 14, colour = "firebrick4", lineheight = 0.8, angle = 0), axis.text.x = element_text(colour = "gray15", face="bold", size= 12, angle = 270, vjust = 0.5, hjust = 1), axis.text.y = element_text(colour = "gray15", face="bold", size= 12, angle = 0, vjust = 0.5, hjust = 1), axis.ticks = element_line(colour = "orange", size = 0.2), plot.background = element_rect(fill = "gray95"), panel.grid.major = element_line(colour = "orange", size = 0.2), panel.grid.minor = element_line(colour = "gray90"), panel.background = element_rect(fill="gray95"))
- !
1)
2)
3) R
4) !
18.03.16