Re: [R] Dataframe with different lengths

2020-07-29 Thread Ulrik Stervbo via R-help
Hi Pedro, I see you use dplyr and ggplot2. Are you looking for something like this: ``` library(ggplot2) library(dplyr) test_data <- data.frame( year = c(rep("2018", 10), rep("2019", 8), rep("2020", 6)), value = sample(c(1:100), 24) ) test_data <- test_data %>% group_by(year) %>% mut

[R] Dataframe with different lengths

2020-07-22 Thread Pedro páramo
Hi all, I am trying to draw a plot with cumsum values but each "line" has different lengths Ilibrary(dplyr) library(tibble) library(lubridate) library(PerformanceAnalytics) library(quantmod) library(ggplot2) getSymbols('TSLA') I want to create the variables: a<-cumsum(dailyReturn(TSLA, subset