Pasos para la pre-entrega y Entrega de proyecto final.
R Markdown documents are fully reproducible. Use a productive notebook interface to weave together narrative text and code to produce elegantly formatted output. Use multiple languages including R, Python, and SQL.
Más información sobre armado de columnas en rmarkdown-cookbook
Preparo librerias con las que voy a trabajar
Revision del dataset
Descargar base en Kaggle
Para crear un nuevo chunk de ejecución de código utilizo \(CTRL + ALT + I\)
\(\text{porcentaje Youtube} = \frac{\text{(Promedio Youtube)}}{\text{(Promedio Total)}}*100\)
\(\text{porcentaje Spotify} = \frac{\text{(Promedio Spotify)}}{\text{(Promedio Total)}}*100\)
Spotify_youtube_reducido <- Spotify_youtube %>%
select(Artist, Track, Album_type, Stream, Channel, Views) %>%
group_by(Artist) %>%
summarise(
promedio_youtube = mean(Views),
promedio_spotify = mean(Stream),
promedio_total = mean(Views+Stream),
porcent_Y = round(promedio_youtube/promedio_total*100,2),
porcent_S = round(promedio_spotify/promedio_total*100,2)) %>%
arrange(desc(promedio_total)) %>%
head(10)
Spotify_youtube_reducido$promedio_youtube <- format(Spotify_youtube_reducido$promedio_youtube,
big.mark= ".", justify= "right")
## Warning in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, :
## 'big.mark' and 'decimal.mark' are both '.', which could be confusing
Un ejemplo de tabla simple con las fechas de entrega de proyecto final
| Entregas | Fecha inicio | Fecha LÃmite |
|---|---|---|
| Pre-entrega | 03 de abril | 10 de abril |
| Entrega | 19 de abril | 9 de mayo |
| Artistas más escuchados en Spotify y Youtube | |||||
| Artist | promedio_youtube | promedio_spotify | promedio_total | porcent_Y | porcent_S |
|---|---|---|---|---|---|
| Ed Sheeran | 1.546.020.777 | 1439488156 | 2985508933 | 51.78 | 48.22 |
| Justin Bieber | 1.099.106.024 | 1209776742 | 2308882766 | 47.60 | 52.40 |
| Coldplay | 999.727.788 | 1177847824 | 2177575612 | 45.91 | 54.09 |
| Post Malone | 639.442.021 | 1525126385 | 2164568406 | 29.54 | 70.46 |
| Dua Lipa | 821.633.931 | 1340807627 | 2162441558 | 38.00 | 62.00 |
| Bruno Mars | 1.024.091.923 | 1089786295 | 2113878218 | 48.45 | 51.55 |
| Imagine Dragons | 909.378.524 | 1185831093 | 2095209617 | 43.40 | 56.60 |
| The Weeknd | 704.603.315 | 1303197338 | 2007800653 | 35.09 | 64.91 |
| Katy Perry | 1.312.063.208 | 660732870 | 1972796077 | 66.51 | 33.49 |
| Calvin Harris | 975.847.614 | 954854185 | 1930701799 | 50.54 | 49.46 |
| Fuente: kaggle.com | |||||
datatable(Spotify_youtube_reducido)
ggplot(Spotify_youtube_reducido, aes(x = Artist, y = reorder(porcent_Y, desc(Artist)))) +
geom_col(fill = "pink", alpha = 1) +
theme_bw() +
coord_flip() +
labs(
title = "Porcentaje de views promedio en youtube ",
subtitle = "Primeros 10 artistas",
caption = "fuente: kaggle",
x = "Artista",
y = "Porcentaje") +
geom_text(aes(x = Artist, label = porcent_Y),
hjust = 1)
x <- c('Product A', 'Product B', 'Product C')
y <- c(20, 14, 23)
y2 <- c(16,12,27)
text <- c('27% market share', '24% market share', '19% market share')
data <- data.frame(x, y, y2, text)
fig <- data %>% plot_ly()
fig <- fig %>% add_trace(x = ~x, y = ~y, type = 'bar',
text = y, textposition = 'auto',
marker = list(color = 'rgb(158,202,225)',
line = list(color = 'rgb(8,48,107)', width = 1.5)))
fig <- fig %>% add_trace(x = ~x, y = ~y2, type = 'bar',
text = y2, textposition = 'auto',
marker = list(color = 'rgb(58,200,225)',
line = list(color = 'rgb(8,48,107)', width = 1.5)))
fig <- fig %>% layout(title = "January 2013 Sales Report",
barmode = 'group',
xaxis = list(title = ""),
yaxis = list(title = ""))
fig