evaluation

Non-standard evaluation in a user-defined function with lapply or with in R

梦想与她 提交于 2019-12-02 01:49:09
问题 I wrote a wrapper around ftable because I need to compute flat tables with frequency and percentage for many variables. As ftable method for class "formula" uses non-standard evaluation, the wrapper relies on do.call and match.call to allow the use of the subset argument of ftable (more details in my previous question). mytable <- function(...) { do.call(what = ftable, args = as.list(x = match.call()[-1])) # etc } However, I cannot use this wrapper with lapply nor with : # example 1: error

Wrapper for a function relying on non-standard evaluation in R

北战南征 提交于 2019-12-02 00:37:31
问题 I wrote a wrapper around ftable because I need to compute flat tables with frequency and percentage for many variables: mytable <- function(...) { tab <- ftable(..., exclude = NULL) prop <- prop.table(x = tab, margin = 2) * 100 bind <- cbind(as.matrix(x = tab), as.matrix(x = prop)) margin <- addmargins(A = bind, margin = 1) round(x = margin, digits = 1) } mytable(formula = wool + tension ~ breaks, data = warpbreaks) A_L A_M A_H B_L B_M B_H A_L A_M A_H B_L B_M B_H 10 0 0 1 0 0 0 0.0 0.0 11.1 0

Non-standard evaluation in a user-defined function with lapply or with in R

梦想与她 提交于 2019-12-02 00:05:19
I wrote a wrapper around ftable because I need to compute flat tables with frequency and percentage for many variables. As ftable method for class "formula" uses non-standard evaluation, the wrapper relies on do.call and match.call to allow the use of the subset argument of ftable (more details in my previous question ). mytable <- function(...) { do.call(what = ftable, args = as.list(x = match.call()[-1])) # etc } However, I cannot use this wrapper with lapply nor with : # example 1: error with "lapply" lapply(X = warpbreaks[c("breaks", "wool", "tension")], FUN = mytable, row.vars = 1) Error

Wrapper for a function relying on non-standard evaluation in R

馋奶兔 提交于 2019-12-01 21:28:24
I wrote a wrapper around ftable because I need to compute flat tables with frequency and percentage for many variables: mytable <- function(...) { tab <- ftable(..., exclude = NULL) prop <- prop.table(x = tab, margin = 2) * 100 bind <- cbind(as.matrix(x = tab), as.matrix(x = prop)) margin <- addmargins(A = bind, margin = 1) round(x = margin, digits = 1) } mytable(formula = wool + tension ~ breaks, data = warpbreaks) A_L A_M A_H B_L B_M B_H A_L A_M A_H B_L B_M B_H 10 0 0 1 0 0 0 0.0 0.0 11.1 0.0 0.0 0.0 12 0 1 0 0 0 0 0.0 11.1 0.0 0.0 0.0 0.0 13 0 0 0 0 0 1 0.0 0.0 0.0 0.0 0.0 11.1 14 0 0 0 1 0

Three questions w.r.t. the environment model of evaluation

﹥>﹥吖頭↗ 提交于 2019-12-01 20:13:18
问题 I am reading the SICP book Here about the imperative programming model. I could not understand the illustration in two points: W.r.t. the arrow from square to the "pair" (the two circles): What does this arrow mean? Though throughout this section, an arrow means "enclosing environment", this specific arrow seems not pointing to an environment.( square 's environment is the global env , not the "pair") Is below a correct understanding: in the value of a procedure definition, its "code text"

Three questions w.r.t. the environment model of evaluation

◇◆丶佛笑我妖孽 提交于 2019-12-01 20:12:32
I am reading the SICP book Here about the imperative programming model. I could not understand the illustration in two points: W.r.t. the arrow from square to the "pair" (the two circles): What does this arrow mean? Though throughout this section, an arrow means "enclosing environment", this specific arrow seems not pointing to an environment.( square 's environment is the global env , not the "pair") Is below a correct understanding: in the value of a procedure definition, its "code text" part (the left circle) has no interpretation of the symbols within. They are just "text". Only at

How big is a sonar database?

为君一笑 提交于 2019-12-01 13:36:08
It might looks like a dumb question. In fact it's more like a poll: how big is your Sonar database? I need this to estimate the requirements for a virtual machine to host my Sonar instance. Also: how big is your team? how many additional bytes is used in the Sonar database for every new commit? I will appreciate any help. I'm assuming that you're referring to Sonar from Codehaus , and not SOund Navigation And Ranging . From the installation page : The Sonar web server requires 500Mo of RAM to run efficiently. In terms of data space and as an indication, on Nemo the public instance of Sonar,

How big is a sonar database?

一世执手 提交于 2019-12-01 10:31:15
问题 It might looks like a dumb question. In fact it's more like a poll: how big is your Sonar database? I need this to estimate the requirements for a virtual machine to host my Sonar instance. Also: how big is your team? how many additional bytes is used in the Sonar database for every new commit? I will appreciate any help. 回答1: I'm assuming that you're referring to Sonar from Codehaus, and not SOund Navigation And Ranging. From the installation page: The Sonar web server requires 500Mo of RAM

Security considerations using “new Function(…)” (during rendertime, expression coming from my Javascript sources)

自闭症网瘾萝莉.ら 提交于 2019-12-01 06:53:47
问题 I'd like to use new Function(...) to generate a function from very reduced code. I'l like to do this to avoid parsing the expression on my own and being as flexible as possible. I avoid eval() whenever possible. But I'm not sure if it's secure enough to use new Function(...) which is also known as being liable to security holes. Background I want to manage the states of menu buttons. So, while defining the buttons, I'd like to write something like { ..., // More button definition state:

Condition evaluation process in Java [duplicate]

妖精的绣舞 提交于 2019-12-01 03:08:40
This question already has an answer here: short-circuiting behavior of conditional OR operator(||) 3 answers Lets say I have the following condition: if ( myList == null || myList.isEmpty() || xomeX == someY ) What is the order of the evaluation of these conditions? Left or right, right to left or random each time? If the first one passes, then the others are ignored? It should be always be left to right except the assignment operator = . You are using short circuit OR operator , hence if the first condition is true , rest of them won't be evaluated. JLS 15.24 : The conditional-or operator is