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 2 argumentos caracteristicos para series de tiempo:
index: una columna que contiene a la variable temporal. En este caso es la columna Date.
key: no es obligatorio cuando solo tiene una serie de tiempo. Si la tabla contiene más d euna serie de tiempo (en filas), si es obligatorio definir el key.
gafa_stock
gafa_stock |>#pipedistinct(Symbol)
El atajo del teclado para escribir |>es CTRL/CMD + SHIFT + M.
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.