Skip to content

Commit 0b756ea

Browse files
committed
Merge pull request sux13#9 from elmerehbi/master
Additions to course 9
2 parents e1d7b34 + d24a517 commit 0b756ea

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

9_DEVDATAPROD/Developing Data Products Course Notes HTML.Rmd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,13 @@ n1$show("inline", include_assets = TRUE, cdn = F)
388388
- [documentation](http://cran.r-project.org/web/packages/googleVis/googleVis.pdf)
389389
- [plot gallery](https://developers.google.com/chart/interactive/docs/gallery)
390390
- [FAQ](https://developers.google.com/chart/interactive/faq)
391+
* can use the pipe operator from magrittr: `mtcars %>% ggvis(~mpg, ~wt, fill = ~ as.factor(am)) %>% layer_points() %>% layer_smooths()`
391392

393+
```{r, echo=F}
394+
suppressPackageStartupMessages(library(magrittr))
395+
suppressPackageStartupMessages(library(ggvis))
396+
mtcars %>% ggvis(~mpg, ~wt, fill = ~ as.factor(am)) %>% layer_points() %>% layer_smooths()
397+
```
392398

393399

394400
### Example (line chart)
@@ -469,7 +475,7 @@ library(plotly); library(ggplot2)
469475
# load data
470476
load("courseraData.rda")
471477
# bar plot using ggplot2
472-
g <- ggplot(myData, aes(y = enrollment, x = class, fill = offering))
478+
g <- ggplot(myData, aes(y = enrollment, x = class, fill = as.factor(offering)))
473479
g <- g + geom_bar(stat = "identity")
474480
g
475481
# initiate plotly object

9_DEVDATAPROD/Developing Data Products Course Notes.Rmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ $\pagebreak$
390390
- [documentation](http://cran.r-project.org/web/packages/googleVis/googleVis.pdf)
391391
- [plot gallery](https://developers.google.com/chart/interactive/docs/gallery)
392392
- [FAQ](https://developers.google.com/chart/interactive/faq)
393+
* can use the pipe operator from magrittr: `mtcars %>% ggvis(~mpg, ~wt, fill = ~ as.factor(am)) %>% layer_points() %>% layer_smooths()`
393394

394395
$\pagebreak$
395396

@@ -481,7 +482,7 @@ library(plotly); library(ggplot2)
481482
# load data
482483
load("courseraData.rda")
483484
# bar plot using ggplot2
484-
g <- ggplot(myData, aes(y = enrollment, x = class, fill = offering))
485+
g <- ggplot(myData, aes(y = enrollment, x = class, fill = as.factor(offering)))
485486
g <- g + geom_bar(stat = "identity")
486487
g
487488
# initiate plotly object

0 commit comments

Comments
 (0)