deport.randportBurSt {PortfolioProbe} | R Documentation

## Write Random Portfolios to a File

### Description

Creates a file of the random portfolios represented by the object given it.

### Usage

    deport.randportBurSt(x, filename = deparse(substitute(x)),
    	what = "horizontal.portfolio", multiplier = 1,
    	names.assets = NULL, to = "csv", blank = "", append = FALSE,
    	subset = NULL)

### Arguments

`x` | required. Object of class `"randportBurSt"` (result of `random.portfolio` and friends).
`filename` | a character string giving the name of the resulting file, or the empty string (`""`). The extension ("csv" or "txt") need not be a part of the string.
`what` | a character string describing the layout of the file. This must partially match either `"horizontal.portfolio"` or `"vertical.portfolio"`.
`multiplier` | either a single number, or a numeric vector with names. If a vector, the names should be the names of any assets that may appear in `x`, and the values give the amount by which to multiply each value in `x`.
`names.assets` | a character vector providing the names of all assets to be represented in the file. The default is to use the union of the assets that are in the random portfolios.
`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. The default is no character at all – the other logical choice for this is `"0"`.
`append` | logical flag. If `FALSE`, then the file is created or overwritten. If `TRUE` (which is only allowed for horizontal portfolios), then the file is appended.
`subset` | if given, a vector that subscripts the random solutions.

### Value

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

### Side Effects

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

### Revision

This help was last revised 2012 April 17.

### See Also

`random.portfolio`.

### Examples

    randport1 <- random.portfolio(1000, prices, varian, long.only=TRUE,
    	gross.value = 1e6, bench.constraint=c(spx=.04^2/252),
    	lin.constraints=cntrysect.conmat, lin.bounds=cntrysect.bounds)

    # create file randport1.csv
    deport(randport1)

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

    # generation in lots, file in shares
    deport(randport1, mult=100)

    # write monetary values in file
    deport(randport1, mult=prices)

    # tab-separated file of vertically oriented portfolios
    # all asset names from prices used
    deport(randport1, to="txt", what="vert", names=names(prices))

[Package PortfolioProbe version 1.06 Index]