Since you have not shown any data, I am guessing at the cause of your problem. The variable *d* seems to be a data frame, since you use it in ggplot(). The function ma(), which comes from the package forecast, takes a univariate time series as its first argument. Here is a quote from the documentation.

ma {forecast} R Documentation

## Moving-average smoothing

## Description

`ma`

computes a simple moving average smoother of a given time series.## Usage

ma(x, order, centre = TRUE)

## Arguments

`x`

Univariate time series `order`

Order of moving average smoother `centre`

If TRUE, then the moving average is centred for even orders.

I would expect ma() to throw an error if you pass it a data frame (edit: if it has more than one column). If my answer has not helped you solve your problem, please tells us what *d* is and what error your are getting. The best way to post is question is with a Reproducible Example.