similar to: dubious behaviour of match.arg() with nested functions.

Displaying 20 results from an estimated 10000 matches similar to: "dubious behaviour of match.arg() with nested functions."

2016 Sep 06
2
The use of match.fun
Dear gurus, I was utterly surprised to learn that one of my examples illustrating the need of match.fun() doesn't give me the expected result. center <- function(x,FUN) FUN(x) center(1:10, mean) mean <- 4 center(1:10, mean) Used to give me the error message "could not find function FUN". Now it just works, even though I didn't expect it to. I believe this is at least
2017 Mar 28
2
`[` not recognized as a primitive in certain cases.
?typeof? is your friend here: > typeof(`[`) [1] "special" > typeof(mc[[1]]) [1] "symbol" > typeof(mc2[[1]]) [1] "special" so mc[[1]] is a symbol, and thus not a primitive. - Lukas > On 28 Mar 2017, at 14:46, Michael Lawrence <lawrence.michael at gene.com> wrote: > > There is a difference between the symbol and the function (primitive >
2010 Dec 21
2
Warning message when items of Hmisc are masked by loading a package.
I've noticed that I get a warning message every time a package masks some functions from Hmisc. The warning message says : Warning message: In identical(get(., i), get(., lib.pos)) : ignoring non-pairlist attributes This happens with eg: library(plyr) library(xtable) I think I've seen this passing by before, but I'm not sure any more. Just thought I'd mention it. Cheers Joris
2010 Jun 08
2
constructing a contingency table (ftable, table)
Dear all, an hopefully quick table question. I have the following data: Two objects that are 2*9 matrix with nine column names (Dis1, ..., Dis9) and the row names (2010,2020). The content are frequencies (numeric). In want to create a table that is along the lines of ftable(UCBAdmissions) and should looks like this: Dis1 | ...| Dis9 2010|2020|....|2010|2020 (first row,first column is the value
2015 Oct 22
3
Changed behaviour when passing a function?
Hi all, When teaching this year's class, I was quite amazed that one of my examples didn't work any longer. I wanted to illustrate the importance of match.fun() with following code: myfun <- function(x, FUN, ...){ FUN(x, ...) } round <- 2 myfun(0.85, FUN = round, digits=1) I expected to see an error, but this code doesn't generate one. It seems as if in the current R
2010 Apr 05
1
use of random and nested factors in lme
Dear all, I've read numerous posts about the random and nested factors in lme, comparison to proc Mixed in SAS, and so on, but I'm still a bit confused by the notations. More specifically, say we have a model with a fixed effect F, a random effect R and another one N which is nested in R. Say the model is described by Y~F Can anyone clarify the difference between : random = ~1|R:N random
2010 Mar 30
2
weighted.median function from package R.basic
Dear all, I want to apply a weighted median on a huge dataset, and I remember a function from the package R.basic that could do this using an internal sorting algorithm qsort. This speeded things up quite a bit. Alas, I can't find that package anywhere anymore. There is a weighted.median function in the package limma too, but I didn't use that before. Anybody who knows what happened to
2014 Oct 03
2
How I() works in a formula
Dear all, I'm updating a package regarding a new type of models, and I'm looking to extend the formula interface with two functions (L() and R() ) for construction of these models. I want to use as much of the formula interface as possible, and hoped to do something similarly to I(). I know the I() function does nothing more than add the class "AsIs". I've been browsing the
2017 May 18
2
[R] R-3.4.0 fails test
> On 18 May 2017, at 13:47 , Joris Meys <jorismeys at gmail.com> wrote: > > Correction: Also dlt uses the default timezone, but POSIXlt is not recalculated whereas POSIXct is. Reason for that is the different way values are stored (hours, minutes, seconds as opposed to minutes from origin, as explained in my previous mail) > I would suspect that there is something more subtle
2019 Oct 11
2
New matrix function
I think you are confusing package and function here. Plus some of the R Core packages, that you mention, contain functions that should probably be replaced by functions with better implementation from packages on CRAN. Best regards Morgan On Fri, 11 Oct 2019 15:22 Joris Meys, <jorismeys at gmail.com> wrote: > > > On Fri, Oct 11, 2019 at 3:55 PM Morgan Morgan <morgan.emailbox
2017 Mar 28
2
`[` not recognized as a primitive in certain cases.
Dear, I have noticed this problem while looking at the following question on Stackoverflow : http://stackoverflow.com/questions/42894213/s4-class-subset-inheritance-with-additional-arguments While going through callNextMethod, I've noticed the following odd behaviour: mc <- call("[",iris,2,"Species") mc[[1]] ## `[` is.primitive(`[`) ## [1] TRUE
2015 Apr 01
4
evaluation in transform versus within
On 01/04/2015 1:35 PM, Gabriel Becker wrote: > Joris, > > > The second argument to evalq is envir, so that line says, roughly, "call > environment() to generate me a new environment within the environment > defined by data". I think that's not quite right. environment() returns the current environment, it doesn't create a new one. It is evalq() that created
2015 Apr 01
1
evaluation in transform versus within
On 01/04/2015 2:33 PM, Joris Meys wrote: > Thank you for the insights. I understood as much from the code, but I > can't really see how this can cause a problem when using with() or > within() within a package or a function. The environments behave like > I would expect, as does the evaluation of the arguments. The second > argument is supposed to be an expression, so I
2018 Jan 31
1
Best practices in developing package: From a single file
I fully agree with Joris and Hadley on roxygen2. Additionally: I wrote and published my first package before roxygen (or roxygen2) was available. I found editing .Rd extremely terse (especially when code is updated). For example, the fact that there are no spaces allowed between } and { in \param{}{} has hurt my brain quite a few times, especially since R CMD check did not give any useful error
2018 Jun 09
4
Date class shows Inf as NA; this confuses the use of is.na()
And now I've seen I copied the wrong part of ?is.na > The default method for is.na applied to an atomic vector returns a logical vector of the same length as its argument x, containing TRUE for those elements marked NA or, for numeric or complex vectors, NaN, and FALSE otherwise. Key point being "atomic vector" here. On Sat, Jun 9, 2018 at 1:41 PM, Joris Meys <jorismeys at
2014 Oct 17
2
Most efficient way to check the length of a variable mentioned in a formula.
Dear R gurus, I need to know the length of a variable (let's call that X) that is mentioned in a formula. So obviously I look for the environment from which the formula is called and then I have two options: - using eval(parse(text='length(X)'), envir=environment(formula) ) - using length(get('X'), envir=environment(formula) ) a bit of
2014 Apr 19
1
lag() not returning a time series object
Dear all, Before I file this as a bug, I wanted to check if I didn't miss something. The help page of lag() says that the function returns a time series object. It actually does return something that looks like a ts object (the attribute tsp is set). But when using a vector, the class "ts" is not added to the result: > avec <- 1:10 > lag(avec) [1] 1 2 3 4 5 6 7 8
2015 Oct 07
1
Error generated by .Internal(nchar) disappears when debugging
Malcolm, I tested the code on a clean R 3.2.0 session. Not even in RStudio, just to rule that out. > sessionInfo() R version 3.2.0 (2015-04-16) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 8 x64 (build 9200) locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5]
2015 Apr 01
2
evaluation in transform versus within
Dear list members, I'm a bit confused about the evaluation of expressions using with() or within() versus subset() and transform(). I always teach my students to use with() and within() because of the warning mentioned in the helppages of subset() and transform(). Both functions use nonstandard evaluation and are to be used only interactively. I've never seen that warning on the help
2017 May 18
2
[R] R-3.4.0 fails test
This has to do with your own timezone. If I run that code on my computer, both formats are correct. If I do this after Sys.setenv(TZ = "UTC") Then: > cbind(format(dlt), format(dct)) [,1] [,2] [1,] "2016-12-06 21:45:41" "2016-12-06 20:45:41" [2,] "2016-12-06 21:45:42" "2016-12-06 20:45:42" The reason for that, is that