[Blotter-commits] r1092 - in pkg/FinancialInstrument: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jun 30 02:06:09 CEST 2012
Author: gsee
Date: 2012-06-30 02:06:09 +0200 (Sat, 30 Jun 2012)
New Revision: 1092
Modified:
pkg/FinancialInstrument/R/find.instrument.R
pkg/FinancialInstrument/man/find.instrument.Rd
Log:
docs
Modified: pkg/FinancialInstrument/R/find.instrument.R
===================================================================
--- pkg/FinancialInstrument/R/find.instrument.R 2012-06-29 21:13:48 UTC (rev 1091)
+++ pkg/FinancialInstrument/R/find.instrument.R 2012-06-30 00:06:09 UTC (rev 1092)
@@ -13,12 +13,12 @@
###############################################################################
-#' Find the primary_ids of instruments that contain certain
-#' strings
+#' Find the primary_ids of instruments that contain certain strings
#'
-#' Uses regular expressions matching to find \code{\link{instrument}}s
+#' Uses regular expression matching to find \code{\link{instrument}}s
#'
-#' @param text string to search for
+#' @param text character string containing a regular expression. This is used
+#' by \code{\link{grep}} (see also) as the \code{pattern} argument.
#' @param where if \dQuote{anywhere} all levels/attributes of the instruments
#' will be searched. Otherwise, \code{where} can be used to specify in which
#' levels/attributes to look. (e.g. \code{c("name", "description")} would only
@@ -30,7 +30,7 @@
#' matching.
#' @param exclude character vector of names of levels/attributes that should not
#' be searched.
-#' @param ... other arguments to pass throught to \code{\link{grep}}
+#' @param ... other arguments to pass through to \code{\link{grep}}
#' @return character vector of primary_ids of instruments that contain the
#' sought after \code{text}.
#' @author Garrett See
@@ -38,7 +38,7 @@
#' \code{\link{regex}}
#' @examples
#' \dontrun{
-#' instruments.bak <- as.list(FinancialInstrument:::.instrument)
+#' instruments.bak <- as.list(FinancialInstrument:::.instrument, all.names=TRUE)
#' rm_instruments(keep.currencies=FALSE)
#' currency("USD")
#' stock("SPY", "USD", description="S&P 500 ETF")
@@ -52,6 +52,10 @@
#' find.instrument("EUR")
#' find.instrument("EUR", Symbols=ls_stocks())
#' find.instrument("USD", "type")
+#'
+#' ## Can be combined with buildHierachy
+#' buildHierarchy(find.instrument("ETF"), "type", "description")
+#'
#' ## Cleanup. restore previous instrument environment
#' rm_instruments(); rm_currencies()
#' loadInstruments(instruments.bak)
Modified: pkg/FinancialInstrument/man/find.instrument.Rd
===================================================================
--- pkg/FinancialInstrument/man/find.instrument.Rd 2012-06-29 21:13:48 UTC (rev 1091)
+++ pkg/FinancialInstrument/man/find.instrument.Rd 2012-06-30 00:06:09 UTC (rev 1092)
@@ -1,14 +1,15 @@
\name{find.instrument}
\alias{find.instrument}
-\title{Find the primary_ids of instruments that contain certain
-strings}
+\title{Find the primary_ids of instruments that contain certain strings}
\usage{
find.instrument(text, where = "anywhere",
Symbols = ls_instruments(), ignore.case = TRUE,
exclude = NULL, ...)
}
\arguments{
- \item{text}{string to search for}
+ \item{text}{character string containing a regular
+ expression. This is used by \code{\link{grep}} (see
+ also) as the \code{pattern} argument.}
\item{where}{if \dQuote{anywhere} all levels/attributes
of the instruments will be searched. Otherwise,
@@ -27,7 +28,7 @@
\item{exclude}{character vector of names of
levels/attributes that should not be searched.}
- \item{...}{other arguments to pass throught to
+ \item{...}{other arguments to pass through to
\code{\link{grep}}}
}
\value{
@@ -35,12 +36,12 @@
contain the sought after \code{text}.
}
\description{
- Uses regular expressions matching to find
+ Uses regular expression matching to find
\code{\link{instrument}}s
}
\examples{
\dontrun{
-instruments.bak <- as.list(FinancialInstrument:::.instrument)
+instruments.bak <- as.list(FinancialInstrument:::.instrument, all.names=TRUE)
rm_instruments(keep.currencies=FALSE)
currency("USD")
stock("SPY", "USD", description="S&P 500 ETF")
@@ -54,6 +55,10 @@
find.instrument("EUR")
find.instrument("EUR", Symbols=ls_stocks())
find.instrument("USD", "type")
+
+## Can be combined with buildHierachy
+buildHierarchy(find.instrument("ETF"), "type", "description")
+
## Cleanup. restore previous instrument environment
rm_instruments(); rm_currencies()
loadInstruments(instruments.bak)
More information about the Blotter-commits
mailing list