[R] type checking --- just a thought
A.J. Rossini
rossini at blindglobe.net
Fri May 14 17:36:26 CEST 2004
S4 methods take care of some of this checking (more specification
needed).
best,
-tony
ivo welch <ivo.welch at yale.edu> writes:
> hi: would it be useful to build into R an optional mechanism that
> typechecks arguments? for example,
>
> sum.across <- function ( inpmatrix : matrixtype( dim[1]>1,
> dim[2]>3 ) ) : vector { }
> # this would define a sum.across function that can take
> # matrices or data sets, but not vectors,
> # and which indicates that it will return a vector.
>
> xsum <- sum.across( 1:10 ); # error
>
> repeat <- function( series : vector( dim>0 ), times : scalar(
> value>0 ) ) : vector;
>
> similarly, a common input error condition may be calling a function
> with a NULL vector, or with a vector with fewer than N observations.
> many statistical functions have such hard-wired limits. I know that
> "if" statements can do this, but this might make for a nice
> standardized language feature. on the other hand, the effort and
> complexity may not be worth the extra functionality.
>
> and one beg to the language maintainers for something that I hope is simple:
>
> in R 1.8.2, please add to the "source" function information where
> (file:linenumber) dies or ends.
>
> regards,
>
> /ivo
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
--
rossini at u.washington.edu http://www.analytics.washington.edu/
Biomedical and Health Informatics University of Washington
Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center
UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable
FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email
CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}}
More information about the R-help
mailing list