Re: [R] type checking --- just a thought

About this list Date view Thread view Subject view Author view Attachment view

From: A.J. Rossini (rossini@blindglobe.net)
Date: Sat 15 May 2004 - 01:36:26 EST


Message-id: <85n04b3ts5.fsf@servant.blindglobe.net>


S4 methods take care of some of this checking (more specification
needed).

best,
-tony

ivo welch <ivo.welch@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@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@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}}

______________________________________________ R-help@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


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:10 EST