The R Project SVN R

Rev

Rev 27541 | Rev 41508 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27541 Rev 27733
Line 44... Line 44...
44
## alternatively,
44
## alternatively,
45
print(try(log("a"), TRUE))
45
print(try(log("a"), TRUE))
46
 
46
 
47
## run a simulation, keep only the results that worked.
47
## run a simulation, keep only the results that worked.
48
set.seed(123)
48
set.seed(123)
49
x <- stats::rnorm(50)
49
x <- rnorm(50)
50
doit <- function(x)
50
doit <- function(x)
51
{
51
{
52
    x <- sample(x, replace=TRUE)
52
    x <- sample(x, replace=TRUE)
53
    if(length(unique(x)) > 30) mean(x)
53
    if(length(unique(x)) > 30) mean(x)
54
    else stop("too few unique points")
54
    else stop("too few unique points")