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. An object of class "randportBurSt" (like the result of random.portfolio).
filename a character string giving the name of the resulting file. 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.

Side Effects

the file is created, overwritten or appended.

Revision

This help was last revised 2010 January 02.

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)

deport(randport1) # create file randport1.csv

# 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.01 Index]