Displaying 3 results from an estimated 3 matches for "kuruvill".
Did you mean:
kuruvilla
2007 Apr 26
3
A coding question involving variable assignments in ifelse()
Dear List,
Below is a simple, standard loss model that takes into account the
terms of an insurance policy:
deductible <- 15
coverage.limit <- 75
insurance.threshold <- deductible + coverage.limit
tmpf <- function() {
loss <- rlnorm(rpois(1, 3), 2, 5)
sum(ifelse(loss > insurance.threshold, loss - coverage.limit,
pmin(loss, deductible)))
}
net <- replicate(1000000, tmpf())
2007 Apr 27
4
how to evaluate a dynamic variable?
Please help me evaluate a "dynamic variable" as show in the code
snippet below.
# regular variable
a = c(1,2,3,4)
# dynamic variable set at runtime
DV = "a"
eval(DV)
--> a
eval(eval(DV))
--> a
# what I want
something_goes_here(DV)
--> 1,2,3,4
Can someone teach me how to do this? Thanks very much.
- Bobby
2007 Apr 27
4
Randomising matrices
I would like to be able to randomise presence-absence (i.e. binary)
matrices whilst keeping both the row and column totals constant. Is
there a function in R that would allow me to do this?
I'm working with vegetation presence-absence matrices based on field
observations. The matrices are formatted to have sites as rows and
species as columns. The presence of a species on a site is