https://github.com/hadley/dplyr
Raw File
Tip revision: 1f57c48a765ad60837ffed1fe0572c40f4b7a3de authored by hadley on 09 January 2015, 12:35:47 UTC
Merge branch 'master' of github.com:hadley/dplyr
Tip revision: 1f57c48
failwith.Rd
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/failwith.r
\name{failwith}
\alias{failwith}
\title{Fail with specified value.}
\usage{
failwith(default = NULL, f, quiet = FALSE)
}
\arguments{
\item{default}{default value}

\item{f}{function}

\item{quiet}{all error messages be suppressed?}
}
\value{
a function
}
\description{
Modify a function so that it returns a default value when there is an
error.
}
\examples{
f <- function(x) if (x == 1) stop("Error!") else 1
\dontrun{
f(1)
f(2)
}

safef <- failwith(NULL, f)
safef(1)
safef(2)
}
\seealso{
\code{\link[plyr]{try_default}}
}
\keyword{debugging}

back to top