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]]
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]]
Thank you for the exhausting answer. Is it possible to add a note to the help page regarding the conclusion (or even the edge cases)? is it possible to add any validation for x in formula.character? On 1 November 2016 at 21:48, William Dunlap <wdunlap at tibco.com> wrote:> 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]]