From wdunlap at tibco.com  Tue Nov  1 21:48:54 2016
From: wdunlap at tibco.com (William Dunlap)
Date: Tue, 1 Nov 2016 13:48:54 -0700
Subject: [Rd] as.formula("x") error on C stack limit
In-Reply-To: <CALCQKuX2NrpsjtPkJUgbUboQAcSstghps6bHxY_mes9a_AKz2A@mail.gmail.com>
References: <CALCQKuX2NrpsjtPkJUgbUboQAcSstghps6bHxY_mes9a_AKz2A@mail.gmail.com>
Message-ID: <CAF8bMcbF4mRVKK-ecJBmKbDE=t5ajh6MYtEbSR1-vMPtpTccYA@mail.gmail.com>

Another example uses formula.character's other arguments:
> as.formula("env")
Error: object of type 'special' is not subsettable
> as.formula("...")
Error in eval(expr, envir, enclos) : '...' used in an incorrect context


It may happen for the same reason that the following does not give an error:
> y <- "response ~ pred1 + pred2"
> as.formula("y")
response ~ pred1 + pred2

and that the followings give a somewhat surprising result

> f <- function(x) { y <- "foo ~ bar" ; as.formula(x) }
> f("y")
response ~ pred1 + pred2
<environment: 0x1e87978>

The character method for formula works well if its 'x' argument looks like
a formula, but it doesn't act consistently otherwise.



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, Nov 1, 2016 at 12:54 PM, Andr?s Tajti <atajti at gmail.com> wrote:

> Dear all,
> I tried to run as.formula("x") and got an error message "Error: C stack
> usage  7971120 is too close to the limit" whether x exists or not. This is
> not the case in as.formula("y"), where "object 'y'  not found" is the error
> message if y not exists, or "invalid formula" error or a formula depending
> on y. Can anyone confirm this is not my special problem, or if it is, why
> it can happen?
>
> Thank you:
> Andr?s
>
> Below the output of sessionInfo():
>
> R version 3.3.1 (2016-06-21)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 14.04.5 LTS
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>  [3] LC_TIME=hu_HU.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=hu_HU.UTF-8    LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=hu_HU.UTF-8       LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=hu_HU.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

	[[alternative HTML version deleted]]



[Rd] as.formula("x") error on C stack limit
William Dunlap