[Bioc-devel] testing class and length of function args

Jim Hester james.f.hester at gmail.com
Thu Jul 23 01:22:41 CEST 2015


Not sure about within Bioconductor but Hadley has a package to do this.

https://github.com/hadley/assertthat

On Wed, Jul 22, 2015 at 4:13 PM, Michael Love <michaelisaiahlove at gmail.com>
wrote:

> it's slightly annoying to write
>
> foo <- function(x) {
>   if ( ! is.numeric(x) ) stop("x should be numeric")
>   if ( ! length(x) == 2 ) stop("x should be length 2")
>   c(x[2], x[1])
> }
>
> i wonder if we could have some core functions that test the class and
> the length in one and give the appropriate stop message.
>
> maybe this exists already
>
> -Mike
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list