deport.portfolBurSt {PortfolioProbe} | R Documentation

## Write Optimization Results to a File

### Description

Creates either a csv (comma separated) file or a txt (tab separated) file that contains the optimized portfolio, the trade, the existing portfolio, or all three.

### Usage

    deport.portfolBurSt(x, filename = deparse(substitute(x)), what = "all",
    	multiplier = 1, to = "csv", blank = "")

### Arguments

`x` | required. An object of class `"portfolBurSt"` (which is an optimized portfolio created by `trade.optimizer`).
`filename` | a character string giving the name of the file to be created, or the empty string (`""`). The extension ("csv" or "txt") need not be a part of the string.
`what` | a character string partially matching one of the following: `"all"`, `"trade"`, `"optimal"`, `"new.portfolio"`, `"existing"`.
`multiplier` | either a single number, or a named vector where the names match the assets that are involved. This is used, for example, when the optimization was performed in terms of lots, but the file is desired to be in shares. Another use is to produce monetary values in the file.
`to` | a character string partially matching one of: `"csv"`, `"txt"`. This controls whether the file is comma-separated or tab-separated.
`blank` | a character string giving the value to be placed in locations that do not occur (in the case when `what = "all"`). The default is no character at all – the other logical choice for this is `"0"`.

### Value

a character string giving the name of the file created; or `NULL` if `filename` is the empty string.

### Side Effects

the file of the specified name is created or overwritten. Except when `filename` is the empty string, then the values are printed.

### Details

The `"optimal"` and `"new.portfolio"` choices for the `what` argument are the same thing.

### Revision

This help was last revised 2012 April 17.

### See Also

`trade.optimizer`, `write.table`.

### Examples

    optim1 <- trade.optimizer(eq.prices, varian, long.only=TRUE,
    	gross.value=1e6, ntrade=60, existing=cur.port)

    # create file named optim1.csv
    deport(optim1)

    # print to screen instead
    deport(optim1, filename="")

    # optimization in lots (of 100), file in shares
    deport(optim1, multiplier=100)

    # write monetary values in the file
    deport(optim1, multiplier=current.prices)

    deport(optim1, what="opt", to="txt")

    deport(optim1, file="opt1zero", what="all", blank="0")

[Package PortfolioProbe version 1.06 Index]