data(edhec)
ret <- edhec[, 1:4]
pspec <- portfolio.spec(assets=colnames(ret))
pspec <- add.constraint(portfolio=pspec, type="position_limit", max_pos=3)
pspec <- add.constraint(portfolio=pspec, type="position_limit", max_pos_long=3, max_pos_short=1)
Run the code above in your browser using DataLab