Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
Acciones
Las “tsibbles” son data frames (‘tibbles’ para series de tiempo). Tienen dos argumentos caracteristicos para series de tiempo:
1) index una columna que contiene la variable temporal. En este caso es la columna ‘Date’.
1) key: no es obligatorio cuando solo tiene una serie de tiempo. Si la tabla contiene más de una serie de tiempo (en filas), si es obligatorio definir el ‘key’
# A tibble: 4 × 1
Symbol
<chr>
1 AAPL
2 AMZN
3 FB
4 GOOG
gafa_stock |>#pasar las columnas a filaspivot_longer(cols =-c(Symbol, Date), names_to ="tipo",values_to ="valor") |>#convertir a tibbleas_tibble() |>#agrupar por acción y tipo de var.group_by(Symbol, tipo) |>#Sacar la media por grupossummarise(media =mean(valor)) |># pasar los tipos a columnaspivot_wider(names_from = Symbol, values_from = media)
`summarise()` has grouped output by 'Symbol'. You can override using the
`.groups` argument.