[英]Time-series plot for two lines using same variable but under different condition
I want to create a two-line time-series plot for sales of tier1 brand and tier2 brand. 我想创建一个两线时间序列图,以销售tier1品牌和tier2品牌。 I am using plot.ts(data$TotalSales) and I am wondering how can I add the condition Tier1="1" and Tier2="1" in it
我正在使用plot.ts(data $ TotalSales),我想知道如何在其中添加条件Tier1 =“ 1”和Tier2 =“ 1”
ts1 <- ts(c(2,4,3,5,4,4,5,4,4,5,4,4,2,7,2,5), start = 1, frequency = 4)
ts2 <- ts(c(2,5,6,2,2,6,2,2,5,2,5,2,2,1,5,1), start = 1, frequency = 4)
plot.ts(ts1, col = "red")
lines(ts2, col= "green")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.