cottrell(a)wfu.edu @ INTERNET skrev 2007-10-18 17:15:52 :
On Thu, 18 Oct 2007, andreas.rosenblad(a)ltv.se wrote:
> Currently, when writing a user-defined function, the parameters >
can be of six types: bool (scalar variable acting as a Boolean >
switch), int (scalar variable acting as an integer), scalar >
(scalar variable), series (data series), list (named list of >
series) and matrix (named matrix or vector).
> > To make it easier to write a user-defined function and make it >
more flexible I would appreciate if three other parameter types >
could be included:
> > * "discrete" (a data series with only discrete values)
> * "proportion" or "quantile" (a scalar which value is between 0
and 1)
> * "select" (providing a list of alternatives to select from).
> > As it is now, the first two parameter types, "discrete" and >
"proportion", could be input to the function as "series" and >
"scalar", and the user has to let the function check if they are >
discrete or between 0 and 1. It would be nice if it instead was >
automatically checked already at the input by the parameter type >
chosen.
"proportion" would be quite easy to do;
"proportion" would be very useful e.g. when the function requires the user
to specify a significance level alpha, which of course has to be between 0
and 1
"discrete" less so. The
trouble is that I don't think "discrete" denotes a well-defined data
type. It would, I suppose, if we restricted it to integer values,
but some people think that's too restrictive. As things stand, I
think it's up to the function writer to decide what counts as
discrete in any given context.
You are right. Well, could you then instead create a parameter type
"intseries" for a a series containing only integers, just as there
currently is a parameter type "int" for a scalar variable acting as an
integer, please?
> For the third parameter type, "select", I imagine
writing e.g. >
function(select rejectionregion["two sided","one sided >
lower","one
sided upper"]) would in the GUI produce a drop-down > list for this
parameter
That's definitely a nice idea. We could have a go at that after the
1.6.6 release.
It would be really great. I am currently writing a function where I want
the user to specify the scale type of the variable, i.e. nominal, ordinal,
interval or ratio scale. It is hard to do as it is now, it would be easier
with e.g. function(select scaletype["nominal scale","ordinal
scale","interval scale","ratio scale"]).
Best regards
Andreas