This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.
library(ggplot2)
library(dplyr)
Attaching package: <U+393C><U+3E31>dplyr<U+393C><U+3E32>
The following objects are masked from <U+393C><U+3E31>package:stats<U+393C><U+3E32>:
filter, lag
The following objects are masked from <U+393C><U+3E31>package:base<U+393C><U+3E32>:
intersect, setdiff, setequal, union
library(skimr)
ggplot()
dplyr::glimpse(mpg)
Observations: 234
Variables: 11
$ manufacturer <chr> "audi", "audi", "audi", "audi", "audi", "audi", "audi", "audi", "audi",...
$ model <chr> "a4", "a4", "a4", "a4", "a4", "a4", "a4", "a4 quattro", "a4 quattro", "...
$ displ <dbl> 1.8, 1.8, 2.0, 2.0, 2.8, 2.8, 3.1, 1.8, 1.8, 2.0, 2.0, 2.8, 2.8, 3.1, 3...
$ year <int> 1999, 1999, 2008, 2008, 1999, 1999, 2008, 1999, 1999, 2008, 2008, 1999,...
$ cyl <int> 4, 4, 4, 4, 6, 6, 6, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8,...
$ trans <chr> "auto(l5)", "manual(m5)", "manual(m6)", "auto(av)", "auto(l5)", "manual...
$ drv <chr> "f", "f", "f", "f", "f", "f", "f", "4", "4", "4", "4", "4", "4", "4", "...
$ cty <int> 18, 21, 20, 21, 16, 18, 18, 18, 16, 20, 19, 15, 17, 17, 15, 15, 17, 16,...
$ hwy <int> 29, 29, 31, 30, 26, 26, 27, 26, 25, 28, 27, 25, 25, 25, 25, 24, 25, 23,...
$ fl <chr> "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "...
$ class <chr> "compact", "compact", "compact", "compact", "compact", "compact", "comp...
Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.
skim(mpg)
Skim summary statistics
n obs: 234
n variables: 11
-- Variable type:character -----------------------------------------------------
variable missing complete n min max empty n_unique
class 0 234 234 3 10 0 7
drv 0 234 234 1 1 0 3
fl 0 234 234 1 1 0 5
manufacturer 0 234 234 4 10 0 15
model 0 234 234 2 22 0 38
trans 0 234 234 8 10 0 10
-- Variable type:integer -------------------------------------------------------
variable missing complete n mean sd p0 p25 p50 p75 p100 hist
cty 0 234 234 16.86 4.26 9 14 17 19 35 <U+2585><U+2587><U+2587><U+2587><U+2581><U+2581><U+2581><U+2581>
cyl 0 234 234 5.89 1.61 4 4 6 8 8 <U+2587><U+2581><U+2581><U+2587><U+2581><U+2581><U+2581><U+2587>
hwy 0 234 234 23.44 5.95 12 18 24 27 44 <U+2583><U+2587><U+2583><U+2587><U+2585><U+2581><U+2581><U+2581>
year 0 234 234 2003.5 4.51 1999 1999 2003.5 2008 2008 <U+2587><U+2581><U+2581><U+2581><U+2581><U+2581><U+2581><U+2587>
-- Variable type:numeric -------------------------------------------------------
variable missing complete n mean sd p0 p25 p50 p75 p100 hist
displ 0 234 234 3.47 1.29 1.6 2.4 3.3 4.6 7 <U+2587><U+2587><U+2585><U+2585><U+2585><U+2583><U+2582><U+2581>
ggplot(mpg) +
geom_point(aes(x = displ, y=hwy, color=class))+
facet_wrap (~drv)
ggplot(data=mpg)+
geom_line(mapping=aes(x=displ,y=hwy))
ggplot(data=mpg)+
geom_bar(aes(x=drv))
data_autos_resumida <- tribble(
~ tipo_traccion, ~ num_obs,
"4" , 104,
"f" , 102,
"r" , 25
)
data_autos_resumida
ggplot(mpg)+
geom_smooth(mapping = aes (x=displ, y = hwy))
library(gapminder)
gapminder
paises_europa <- filter(gapminder, continent == "Europe")
paises_europa
glimpse (paises_europa)
Observations: 360
Variables: 6
$ country <fct> Albania, Albania, Albania, Albania, Albania, Albania, Albania, Albania, A...
$ continent <fct> Europe, Europe, Europe, Europe, Europe, Europe, Europe, Europe, Europe, E...
$ year <int> 1952, 1957, 1962, 1967, 1972, 1977, 1982, 1987, 1992, 1997, 2002, 2007, 1...
$ lifeExp <dbl> 55.230, 59.280, 64.820, 66.220, 67.690, 68.930, 70.420, 72.000, 71.581, 7...
$ pop <int> 1282697, 1476505, 1728137, 1984060, 2263554, 2509048, 2780097, 3075321, 3...
$ gdpPercap <dbl> 1601.056, 1942.284, 2312.889, 2760.197, 3313.422, 3533.004, 3630.881, 373...
ggplot()+
geom_point(data = paises_europa,mapping = aes(x =gdpPercap , y=lifeExp, size=pop))