[R] Plot mortality data and show trend

Jim Lemon jim at bitwrit.com.au
Tue Dec 10 00:40:53 CET 2013


On 12/10/2013 07:53 AM, Norbi Gurracho wrote:
> I have a mortality data over many years  and I wish to plot the data and also add some smoother to clearly highlight the trend. How could I do that in R with base graphics or ggplot? I have the following sample data: require(lubridate) mdate<-seq(ymd('2000-01-01'),ymd('2010-12-31'), by = '1 day') death<- rnorm(4018, 80, 45) df<-cbind(mdate,death)  		 	   		

Hi Norbi,
One way is:

plot(mdate,death,type="l",col="lightgray")
lines(supsmu(mdate,death))

Jim



More information about the R-help mailing list