Custom expected returns in the Portfolio Analytics package

I realise now, after setting the bounty, that the questions has already been answered here. I'll summarise as best as I can understand it.

When you call optimize.portfolio, there is an optional parameter momentFUN, which defines the moments of your portfolio. One of its arguments is momentargs, which you can pass through in optimize.portfolio.

First, you need to choose a set of expected returns. I'll assume the last entry in your views time series:

my.expected.returns = views["2009-08-31"] 

You'll also need your own covariance matrix. I'll compute it from your returns:

my.covariance.matrix = cov(returns)

Finally, you'll need to define momentargs, which is a list consisting of mu (your expected returns), sigma (your covariance matrix), and third and fourth moments (which we'll set to zero):

num_assets = ncol(current.view)
momentargs = list()
momentargs$mu = my.expected.returns
momentargs$sigma = my.covariance.matrix
momentargs$m3 = matrix(0, nrow = num_assets, ncol = num_assets ^ 2)
momentargs$m4 = matrix(0, nrow = num_assets, ncol = num_assets ^ 3)

Now you're ready to optimize your portfolio:

o = optimize.portfolio(R = returns, portfolio = pf, momentargs = momentargs)