Thanks again all. Essentially, this is the section of the code that is
causing trouble. This is part of the (exported) function which calls
contr.none (not exported). As mentioned, when I call the exported function
it complains with the error described before.


  oldcontrasts <- unlist(options("contrasts"))
    if (cts)
        options(contrasts = c(unordered = "contr.none", ordered =
"contr.diff"))
    x <- model.matrix(terms(reformulate(var_names)), mf, contrasts)
    options(contrasts = oldcontrasts)

Axel.


On Sat, Jan 25, 2014 at 10:19 PM, Gabriel Becker <gmbec...@ucdavis.edu>wrote:

> I haven't seen all of your code, but are you using get to obtain the
> object yourself? If so, that is likely your problem, as that is (roughly)
> equivalent to typing the name at the prompt, it won't see unexported
> functions. It shouldn't be necessary to do, though.
>
> contrasts = switch(ctr,
> "contr.none" = contr.none(<stuff>),
> "contr.some" = contr.some(<stuff>),
> default = stop("unrecognized contrast function")
> )
>
> or something similar is much more legible, and thus maintainable, anyway.
>
> Non-standard lookup/evaluation can be powerful, and even necessary to do
> certain particular things, but it's a very large and highly specialized
> hammer that is usually more trouble than it is worth. Many things people
> are tempted to do with it don't really require it at all, and in fact are
> easier without it.
>
> HTH,
> ~G
>

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to