findFn(string, maxPages = 20)
Do a search for functions, which opens an interactive HTML page of results. The results may be sorted in a variety of ways and also link to help files for each function. The results page will automatically open in whatever application has been designated to open .html files (usually a browser is the default).
- string – A character string to search.
- maxPages – Maximum number of pages to return, i.e. number of links is 20*maxPages.
getReturns(ticker, freq=”month”, get=”overlapOnly”, start=”1970-01-01″, end=NULL)
Retrieve stock performance data from Yahoo! Finance. Use the returned object to fit a stock model (via stockModel) and then estimate the optimal portfolio based on that model (via optimalPort).
- ticker – A character vector of stock tickers.
- freq – Indicate what resolution should be retrieved: "month" (the default), "week", or "day".
- get – Indicate whether the processed returns should include only overlapping dates for the stocks (the default) or whether all processed returns data should be provided ("all").
- start – The earliest date to begin retrieving stock data, input as "YYYY-MM-DD".
- end – The end date as "YYYY-MM-DD" (default is the most recent trading day).
Create high quality maps that may be shaded or projected in a variety of ways. While today’s post just covers generating a basic map, additional arguments may be used for coloring in counties, states, or countries (col, fill), looking at different map projections (projection), among many many other options.
- database – Usually one of four databases: "world", "usa", "state", "county". More databases are available.
- regions – By default, all regions in the database will be generated. However, specific regions for plotting may be specified using a vector of character strings.
Generate a nicely formatted table for LaTeX or a basic table for HTML.
- x – An R object that could conceivably be formatted into a table. A wide range of objects are accepted.
Use R to create a tarball (tar.gz zip file) or to unzip a tarball.
tar(tarfile, files = NULL)
- tarfile – Name of the tar.gz file to be generated.
- files – List of files to be placed into the tarball.
untar(tarfile, exdir = “.”)
- tarfile – Name of the tar.gz file to be unzipped.
- exdir – Where to put the files.
Create a new folder on your computer from R using the dir.create function.
- path – A folder to be generated in the current working directory, or specify a path, e.g. "../../path/to/new/directory/newFolder".
Check if two objects are equal, or at least very nearly equal. Don’t get tripped up by the argument names, which make it sound like this function is only for a very specific scenario (convergence) when in truth it can be used for a wide variety of scenarios.
- target – An R object.
- current – A second R object to compare to target (the first argument).
As noted in the complete help file, if using all.equal
in an if
statement, wrap it inside of the isTRUE
Check if an R object exists in the current session. Functions and data objects from the base or other packages may also be checked.
- x – The name of an R object as a character string.
zapsmall(x, digits = getOption(“digits”)))
If some values of x are nearly zero relative to the larger values in x, then zapsmall will set those small values to zero.
- x – A numeric vector.
- digits – An integer indicating the precision.
While not a perfect rule, anticipate values of x that are, in absolute value, less than 1 and are 10^digits smaller than the largest values of x to be set to zero.