similar to: The use of match.fun

Displaying 20 results from an estimated 10000 matches similar to: "The use of match.fun"

2020 Apr 13
3
detect ->
Using => and <= instead of -> and <- would make things easier, although the precedence would be different. Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Apr 13, 2020 at 1:43 AM Adrian Du?a <dusa.adrian at gmail.com> wrote: > Thank you for your replies, this actually has little to do with the > regular R code but more to signal what in my package QCA is referred
2016 Apr 12
2
formula argument evaluation
On Tue, Apr 12, 2016 at 2:08 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > [...] > > It never gets to evaluating it. It is not a legal R statement, so the parser signals an error. > If you want to pass arbitrary strings to a function, you need to put them in quotes. I see. I thought it was parsed inside the function, but if it's parsed before then quoting is the
2016 Apr 12
3
formula argument evaluation
I have a simple function such as: foo <- function(x) { call <- lapply(match.call(), deparse) testit <- capture.output(tryCatch(eval(x), error = function(e) e)) if (grepl("Error", testit)) { return(call$x) } } and I would like to detect a formula when x is not an object: # this works > foo(A + B) [1] "A + B" # but this doesn't >
2016 Apr 13
2
formula argument evaluation
I suppose it would work, although "=>" is rather a descriptive symbol and less a function. But choosing between quoting: "A + B => C" and a regular function: A + B %=>% C probably quoting is the most straightforward, as the result of the foo() function has to be a string anyways (which is parsed by other functions). On Tue, Apr 12, 2016 at 6:20 PM, Richard M.
2020 Apr 13
3
detect ->
Adrian, Indeed, this has come up in a few places, but as Gabor says, there is no such thing as right hand assignment at any point after parsing is complete. This means the only feasible way to detect it, which a few projects do I believe, is process the code while it is still raw text, before it goes into the parser, and have clever enough regular expressions. The next question, then, is why
2020 Apr 13
2
detect ->
I searched and tried for hours, to no avail although it looks simple. (function(x) substitute(x))(A <- B) #A <- B (function(x) substitute(x))(A -> B) # B <- A In the first example, A occurs on the LHS, but in the second example A is somehow evaluated as if it occured on the RHS, despite my understanding that substitute() returns the unevaluated parse tree. Is there any way, or is
2016 Apr 12
0
formula argument evaluation
Would making it regular function %=>%, using "%" instead of quotes, work for you? On Tue, Apr 12, 2016 at 11:09 AM, Adrian Du?a <dusa.adrian at unibuc.ro> wrote: > On Tue, Apr 12, 2016 at 2:08 PM, Duncan Murdoch <murdoch.duncan at gmail.com> > wrote: >> [...] >> >> It never gets to evaluating it. It is not a legal R statement, so the > parser
2020 May 22
2
GCC warning
I am trying to submit a package on CRAN, and everything passes ok on all platforms but Debian, where CRAN responds with an automatic "significant" warning: * checking whether package ?QCA? can be installed ... [35s/35s] WARNING Found the following significant warnings: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ?__builtin_strncpy? output may be truncated
2015 Oct 06
4
authorship and citation
Adrian, I am not on the CRAN or R-core teams, so the following is my own view, but... > library(QCA) > > Users are encouraged to cite this package as: > > Dusa, Adrian (2015). QCA: Qualitative Comparative Analysis. R Package > Version 1.2-0, > URL: http://cran.r-project.org/package=QCA > > This is just an encouragement, not a requirement, and the official citation
2016 Apr 13
0
formula argument evaluation
%=>% would have precendence ('order of operations') problems also. A + B %=>% C is equivalent to A + ( B %=>% C) and I don't think that is what you want. as.list(quote(A + B %=>% C)) shows the first branch in the parse tree. The following function, str.language, shows the entire parse tree, as in > str.language(quote(A + B %=>% C)) `quote(A + B %=>%
2018 Mar 09
2
importing namespaces from base packages
Dear All, I understand the R CMD checks with only the base package attached, everything else (including the other packages bundled with the base R) should be imported and most importantly declared in the Imports field from the DESCRIPTION file. However, I do use functions from other packages than base (utils, grDevices, stats, graphics), for which it is sufficient to declare importFrom() in the
2015 Oct 06
2
authorship and citation
Adrian, Responses inline On Tue, Oct 6, 2015 at 1:58 PM, Adrian Du?a <dusa.adrian at unibuc.ro> wrote: > Hi Gabriel, > > On Tue, Oct 6, 2015 at 10:59 PM, Gabriel Becker <gmbecker at ucdavis.edu> > wrote: > >> [...] >> >> At the very least, this is seems to be a flagrant violation of the >> *spirit* of the CRAN policy, which AFAIK is intended to
2016 Apr 05
3
Problem with <= (less than or equal): not giving the expected result
Thanks Adrian and Thierry (from the previous answer). I was aware of the all.equal function, but there is nothing similar for <= (e.g. all.smallerEqual)? cheers, jo On 05 Apr 2016, at 14:31, Adrian Du?a <dusa.adrian at unibuc.ro<mailto:dusa.adrian at unibuc.ro>> wrote: Yes, that does have to do with floating point representation. I use this function for these types of
2017 Jun 27
2
paste strings in C
Dear R-devs, Below is a small example of what I am trying to achieve, that is trivial in R and I would like to learn how to do in C, for very large matrices: > (mymat <- matrix(c(1,0,0,2,2,1), nrow = 2)) [,1] [,2] [,3] [1,] 1 0 2 [2,] 0 2 1 And I would like to produce: [1] "a*C" "B*c" Which can be trivially done in R via something like: foo
2015 Oct 06
3
authorship and citation
On Oct 5, 2015, at 6:31 PM, Uwe Ligges <ligges at statistik.tu-dortmund.de> wrote: > > > On 05.10.2015 23:47, Andrew Robinson wrote: >> As a fourth option, I wonder if the first author could fork the package? >> >> Presumably, appropriately cited, a fork is permitted by the license under >> which it was released. Then the original package, by both
2016 Sep 06
0
The use of match.fun
I am not able to replicate this: > center <- function(x,FUN) FUN(x) > center(1:10, mean) [1] 5.5 > mean <- 4 > center(1:10, mean) Error in center(1:10, mean) : could not find function "FUN" Using a fresh install of version 3.3.1 under MacOS, and tested before with 3.3.0 with the same result. On Tue, Sep 6, 2016 at 4:25 PM, Joris Meys <jorismeys at gmail.com>
2015 Dec 17
1
integer
In the help page for ?is.integer, there is this function is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol A quick question: is there a case where this alternative function will not work? function(x) x %% 1 == 0 Best, Adrian -- Adrian Dusa University of Bucharest Romanian Social Data Archive Soseaua Panduri nr.90 050663 Bucharest sector 5
2016 Apr 08
4
(no) circular dependency
Hi Mark, Uhm... sometimes this is not always possible. For example I have a package QCA which produces truth tables (all combinations of presence / absence of causal conditions), and it uses the venn package to draw a Venn diagram. It is debatable if one should assimilate the "venn" package into the QCA package (other people might want Venn diagrams but not necessarily the other QCA
2016 Apr 14
0
Bug in by() function which works for some FUN argument and does not work for others
I think you are not using the best function for what your intentions are. Try: > by(data=mtcars, INDICES=list(as.factor(mtcars$am)), FUN=colMeans) : 0 mpg cyl disp hp drat wt qsec vs 17.1473684 6.9473684 290.3789474 160.2631579 3.2863158 3.7688947 18.1831579 0.3684211 am gear carb 0.0000000
2015 Oct 06
1
authorship and citation
On Tue, Oct 6, 2015 at 2:52 PM, Adrian Du?a <dusa.adrian at unibuc.ro> wrote: > Dear Gabriel, > > On Wed, Oct 7, 2015 at 12:39 AM, Gabriel Becker <gmbecker at ucdavis.edu> > wrote: > >> [...] >> >>> >>> I apologize for pushing this topic to the limit, but I haven't got an >>> answer to this question yet... >>> >>