[Blotter-commits] r715 - in pkg/FinancialInstrument: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Aug 6 18:32:35 CEST 2011
Author: gsee
Date: 2011-08-06 18:32:34 +0200 (Sat, 06 Aug 2011)
New Revision: 715
Modified:
pkg/FinancialInstrument/R/instrument.R
pkg/FinancialInstrument/man/instrument_attr.Rd
Log:
update examples for instrument_attr
Modified: pkg/FinancialInstrument/R/instrument.R
===================================================================
--- pkg/FinancialInstrument/R/instrument.R 2011-08-06 16:13:07 UTC (rev 714)
+++ pkg/FinancialInstrument/R/instrument.R 2011-08-06 16:32:34 UTC (rev 715)
@@ -488,14 +488,19 @@
#' @param attr name of the slot that will be added or changed
#' @param value what to assign to the \code{attr} slot of the \code{primary_id} instrument
#' @return called for side-effect
+#' @note you can remove an attribute/slot from an instrument by calling this function with \code{value=NULL}
#' @examples
#' \dontrun{
#' currency("USD")
#' stock("SPY","USD")
-#' instrument_attr('USD','description',"U.S. Dollar")
-#' instrument_attr("SPY", "description", 'An ETF')
+#' instrument_attr("USD","description","U.S. Dollar")
+#' instrument_attr("SPY", "description", "An ETF")
#' getInstrument("USD")
#' getInstrument("SPY")
+#'
+#' #Call with value=NULL to remove an attribute
+#' instrument_attr("SPY", "description", NULL)
+#' getInstrument("SPY")
#' }
#' @export
instrument_attr <- function(primary_id, attr, value) {
Modified: pkg/FinancialInstrument/man/instrument_attr.Rd
===================================================================
--- pkg/FinancialInstrument/man/instrument_attr.Rd 2011-08-06 16:13:07 UTC (rev 714)
+++ pkg/FinancialInstrument/man/instrument_attr.Rd 2011-08-06 16:32:34 UTC (rev 715)
@@ -21,14 +21,22 @@
This function will add or overwrite the data stored in
the specified slot of the specified instrument.
}
+\note{
+ you can remove an attribute/slot from an instrument by
+ calling this function with \code{value=NULL}
+}
\examples{
\dontrun{
currency("USD")
stock("SPY","USD")
-instrument_attr('USD','description',"U.S. Dollar")
-instrument_attr("SPY", "description", 'An ETF')
+instrument_attr("USD","description","U.S. Dollar")
+instrument_attr("SPY", "description", "An ETF")
getInstrument("USD")
getInstrument("SPY")
+
+#Call with value=NULL to remove an attribute
+instrument_attr("SPY", "description", NULL)
+getInstrument("SPY")
}
}
More information about the Blotter-commits
mailing list