-
Notifications
You must be signed in to change notification settings - Fork 0
/
flexdash2.Rmd
59 lines (43 loc) · 1.11 KB
/
flexdash2.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
title: "Ejemplo 2"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(plotly)
base=read.csv("manzanas.csv", sep = ";")
base$trat=as.factor(base$trat)
```
Column
-----------------------------------------------------------------------
### Chart A
```{r}
p <- ggplot(base, aes(x=color, y=trat)) +
geom_point(shape=1)
ggplotly(p)
```
Column {.tabset }
-----------------------------------------------------------------------
### Chart B
```{r}
n <- 20
x1 <- rnorm(n); x2 <- rnorm(n)
y1 <- 2 * x1 + rnorm(n)
y2 <- 3 * x2 + (2 + rnorm(n))
A <- as.factor(rep(c(1, 2), each = n))
df <- data.frame(x = c(x1, x2), y = c(y1, y2), A = A)
fm <- lm(y ~ x + A, data = df)
p <- ggplot(data = cbind(df, pred = predict(fm)), aes(x = x, y = y, color = A))
p <- p + geom_point() + geom_line(aes(y = pred))
ggplotly(p)
```
### Chart C
```{r}
p1 <- ggplot(base, aes(x=juez, y=color)) +
geom_point(shape=2)
ggplotly(p1)
```