Description Usage Arguments Details Author(s) Examples
subset operator for estimate class from decisionSupport package.
1 2 |
x |
estimate object |
i, j |
elements to extract or replace by index or dimnames. |
drop |
logical. If TRUE the result is coerced to the lowest possible dimension. The default is to drop if only one column is left, but not to drop if only one row is left. |
Attempt to drop any of the required estimate columns (i.e distribution, min, max ) is silently ignored since estimate object may not make sense without them.
Issoufou Liman
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## This example is taken fom decisionSupport
library (decisionSupport)
# Create an estimate from text (with correlated components):
estimateTextMarg<-'variable, distribution, lower, upper
revenue1, posnorm, 100, 1000
revenue2, posnorm, 50, 2000
costs1, posnorm, 50, 2000
costs2, posnorm, 100, 1000'
estimateTextCor<-', revenue1, costs2
revenue1, 1, -0.3
costs2, -0.3, 1'
estimateCor <- as.estimate (read.csv (header=TRUE, text=estimateTextMarg,
strip.white = TRUE, stringsAsFactors = FALSE),
correlation_matrix = data.matrix (read.csv (text = estimateTextCor,
row.names = 1, strip.white = TRUE)))
## extracting the first row.
estimateCor [1, ]
## extracting all the rows keep everything intact.
estimateCor [1:4, ]
## Trying to drop mandatory column is ignored.
estimateCor [, 1]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.