showExample: Display examples

Description Usage Arguments Details Value Note Author(s) References Examples

Description

Display the code examples from ‘Numerical Methods and Optimization and Finance’.

Usage

1
2
3
showExample(file = "", chapter = NULL, showfile = TRUE,
            includepaths = FALSE, ...)
showChapterNames()

Arguments

file

a character vector of length one. See Details.

chapter

optional: a character vector of length one, giving the chapter name (see Details), or an integer, indicating a chapter number. Default is NULL: look in all chapters.

showfile

Should the file be displayed with file.show? Defaults to TRUE. A file will be displayed if only a single file is identified by file and chapter.

includepaths

Should the file paths be displayed? Defaults to FALSE.

...

Arguments passed to grepl; see Details.

Details

showExample matches the specified file argument against the available file names via grepl(file, filenames, ...). If chapter is specified, a second match is performed, grepl(chapter, chapternames, ...). The chapternames are those in the book (eg, ‘Modeling dependencies’). The selected files are then those for which file name and chapter name could be matched.

Value

showExample returns a data.frame of at least two character vectors, Chapter and File. If includepaths is TRUE, Paths are included. If no file is found, the data.frame has zero rows. If a single file is identified and showfile is TRUE, the function has the side effect of displaying that file.

showChapterNames returns a character vector of length 15: the names of the book's chapters.

Note

The files can also be downloaded from http://nmof.net .

Author(s)

Enrico Schumann

References

Gilli, M., Maringer, D. and Schumann, E. (2011) Numerical Methods and Optimization in Finance. Elsevier. http://www.elsevierdirect.com/product.jsp?isbn=9780123756626

Schumann, E. (2016) Financial Optimisation with R (NMOF Manual). http://enricoschumann.net/NMOF.htm#NMOFmanual

Examples

1
2
3
4
5
6
7
showExample("equations.R")

showExample("example", chapter = "portfolio")
showExample("example", chapter = "Portfolio")
showExample("example", chapter = "portfolio", ignore.case = TRUE)
showExample("example", chapter = 13)
showExample("example", chapter = showChapterNames()[13L])

enricoschumann/NMOF documentation built on June 5, 2019, 8:56 a.m.