[R] Dataframe with different lengths

Pedro páramo percent||101 @end|ng |rom gm@||@com
Wed Jul 22 13:16:38 CEST 2020


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 = c('2019')) )
b<-cumsum(dailyReturn(TSLA, subset = c('2020')) )
c<-cumsum(dailyReturn(TSLA, subset = c('2018')) )

Each value, on a,b,c has two columns date, and values.

The thing is I want to plot the three lines in one plot with the maximum
values of a,b,c in this case a has 252 values, and plot the other two lines
could be in the axis I should put (x <- 1:252) on the axis but I was not
able for the moment.

	[[alternative HTML version deleted]]



More information about the R-help mailing list