Начать. Это бесплатно
или регистрация c помощью Вашего email-адреса
Week 2 создатель Mind Map: Week 2

1. g + geom_point(aes(color = bmicat), size = 4, alpha = 1/2)

1.1. aes() функция нужна потому что присаеваем перееменную цвету

1.2. Если бы была константа, то функцию aes можно было бы опустить

2. Basic ideas

2.1. data frame

2.2. aesthetic mapping

2.2.1. how data are mapped to color, size

2.2.2. aes parameter

2.3. geoms

2.3.1. geometric objects

2.4. facets

2.4.1. for conditional plots

2.5. stats

2.5.1. Statistical transformations

2.6. scales

2.6.1. mappings like: males - blue, female - red

2.7. coordinate system

2.8. Plots build in layers

2.8.1. PLot data

2.8.2. Overlay a summary

2.8.3. Metadata and annotations

2.9. ggplot() returns an object - can assign it to object

2.9.1. g <- ggplot(...)

2.9.2. p <- g + geom_point()

2.9.2.1. geom_line()

2.9.3. print(p)

2.9.4. p + geom_smooth(method = "lm")

2.9.5. p + facet_grid(. ~ bmicat)

2.10. xlab(), yab(), labs(), ggtitle()

2.11. theme() for global options

2.11.1. theme(legend.position = "none")

2.11.2. prebuilt theme

2.11.2.1. theme_gray() = default

2.11.2.2. theme_bw()

2.12. Как можно убрать outlier из графика

2.12.1. g + geom_line() + coord_cartesian(ylim = c(-3, 3))

2.12.2. график будет ограничен между -3 и 3

2.13. Если надо построить график зависимости от непрерывной переменной, то надо разрезать её на factor'ы

2.13.1. cutpoints <- quantile(data, seq(0, 1, length = 4), na.rm = T)

2.13.2. fac <- cut(data, cutpoints)

2.13.3. use fac to build the chart

3. Lattice

3.1. Good for Multidimensional data

3.2. lattice package

3.2.1. depends on grid package

3.2.1.1. rarely used by user

3.3. Everything is done in one function code

3.4. Functions

3.4.1. xyplot

3.4.1.1. xyplot(y ~ x | f * g, data)

3.4.1.1.1. f * g - conditional variables, по ним идет фильтрация

3.4.1.1.2. xyplot(Ozone ~ Wind | Month, data =airquality, layout = c(5,1))

3.4.2. bwplot

3.4.3. histogram

3.4.4. stripplot

3.4.5. dotplot

3.4.6. splom

3.4.7. levelplot

3.4.8. contourplot

3.5. Returns object of type trellis

3.5.1. trellis plot object is plotted due to auto-print of R

3.5.2. Can write: p <- xyplot(...) print(p) # here graph will appear

3.6. Panel functions

3.6.1. Controls what happens in panels

3.6.2. Received x,y coordinates

3.6.3. Argument in xyplot function

3.6.4. Every function should be from lattice package or your own, not from base package

4. ggplot2

4.1. An implementation of the Grammar of Graphics by Leland Wilkinson

4.2. Implemented by Hadley Wickham

4.3. qplot()

4.3.1. Looks for data

4.3.2. plots are made up of aesthetics and geoms

4.3.3. Uses factors heavilty to subset data

4.3.3.1. They should be labeled

4.3.3.2. qplot(displ, hwy, data = mpg, color = drv)

4.3.3.3. Legend is created automatically

4.3.3.4. qplot(displ, hwy, mpg, geom = ("point", "smooth")

4.3.3.4.1. Ads linear model

4.3.3.4.2. Can specify model by parameter method = "lm"

4.3.3.5. Histogram: qplot(hwy, data = mpg, fill = drv)

4.3.3.6. geom = "density" draws density smooth

4.3.4. facets - panels in Lattice

4.3.4.1. qplot(displ, hwy, data = mpg, facets = . ~ drv)

4.3.4.1.1. . ~ drv говорит, что должно быть по колонке на каждое значение drv

4.3.4.2. qplot(displ, hwy, data = mpg, facets = drv ~ ., bandwidth = 2)

4.3.4.2.1. drv ~ . говорит, что по строчке, на каждое значение drv