Search code examples
ruser-interfacegwidgets

What is the use of 'length.out' and 'along.with' arguments in gslider()?


What is the use of length.out and along.with arguments in gslider() from gWidgets2? In ?gslider I can only see (the rather counter-intuitive):

by              step size if not specified by from
length.out      in place of by
along.with      in place of length.out

Does this imply that the three arguments are synonyms?


Solution

  • Look at the source code.

     if (!is.null(length.out)) {
       by <- (to - from)/(length.out[1] - 1)
     }
    

    If present, say length.out = 5, it sets by to be (to - from) / 4. As for the latter,

    if (!missing(along.with)) {
       length.out <- length(along.with)
    }
    

    it allows you to, e.g., pass a list of length n and then length.out will be n. I won't speak as to the usefulness of these arguments but I guess the author must have thought they'd come in handy.