'How to replace a title in a plot

I have a time series taken from this link, i used these commands to separate the components of the time series:

pil.us <- read.csv("./Datasets/GDP.csv", sep = ",")
xt <- ts(pil.us$GDP, start=(1947,1), freq=4)
d.pil <- decompose(xt, type="additive")

Now, what i want to do is to plot these components together and change the title of the plot, i tried this

plot(d.pil, main="Decomposizione della serie storica PIL US")

but it gives me the error Formal argument "main" matched by multiple actual arguments and i think this happens because d.pil is a dataframe.

I also tried this:

plot(d.pil)
title(main="Decomposizione della serie storica PIL US")

I get this plot, but as you can see, the new title did not replace the old. Plot

How can i get a plot with only one title?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source