similar to: apply a function on elements of a list two by two

Displaying 20 results from an estimated 10000 matches similar to: "apply a function on elements of a list two by two"

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 >
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
2012 Feb 24
1
function remains loaded in the search space after detaching the package
I ran into some very irritating behaviour I don't understand. Let me illustrate with the package gdata() and the function print.object_size() : > print(object.size(iris),units='Kb') 6.3 Kb > getAnywhere(print.object_size) A single object matching ?print.object_size? was found It was found in the following places registered S3 method for print from namespace utils
2010 Jun 21
2
ctree
Hello, This is a re-submittal of question I submitted last week, but haven't rec'd any responses. I need to extract the probabilities used to construct the barplots displayed as part of the graph produced by plot("ctree"). For example, library(party) iris.ct <- ctree(Species ~ . , data = iris) plot(iris.ct) Instead of a simple example with only 4 terminal nodes, my
2010 Jun 24
1
Question on WLS (gls vs lm)
Hi all, I understand that gls() uses generalized least squares, but I thought that maybe optimum weights from gls might be used as weights in lm (as shown below), but apparently this is not the case. See: library(nlme) f1 <- gls(Petal.Width ~ Species / Petal.Length, data = iris, weights = varIdent(form = ~ 1 | Species)) aa <- attributes(summary(f1)$modelStruct$varStruct)$weights f2 <-
2011 Feb 15
1
Using rasterImage on a CairoWin device prevents adding further elements to device?
I was pointed to the Cairo package for plotting PNG images on a device. I've been playing around with it, but found that after I use the rasterImage function, I can't add anything any more to the device, eg : img <- readPNG(system.file("img", "Rlogo.png", package="png")) r = as.raster(img[,,1:3]) r[img[,,4] == 0] = "white" CairoWin()
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
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
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
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
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 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
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
2011 Feb 04
2
terribly annoying bug with POSIXlt : one o'clock is midnight?
Apparently, as.POSIXlt takes one o'clock as the start of the day : > as.POSIXlt(0,origin="1970-01-01") [1] "1970-01-01 01:00:00 CET" > as.POSIXlt(0,origin="1970-01-01 00:00:00") [1] "1970-01-01 01:00:00 CET" > as.POSIXlt(0,origin="1970-01-01 23:59:59") [1] "1970-01-02 00:59:59 CET" Cheers -- Joris Meys Statistical
2010 Jul 28
1
strange error : isS4(x) in gamm function (mgcv package). Variable in data-frame not recognized???
Dear all, I run a gamm with following call : result <- try(gamm(values~ s( VM )+s( RH )+s( TT )+s( PP )+RF+weekend+s(day)+s(julday) ,correlation=corCAR1(form=~ day|month ),data=tmp) )" with mgcv version 1.6.2 No stress about the data, the error is not data-related. I get : Error in isS4(x) : object 'VM' not found What so? I did define the dataframe to be used, and the
2017 Jun 27
2
texi2pdf doesn't find the correct MikTex installation due to erroneous Sys.which()
I checked after this question popped up on Stackoverflow: https://stackoverflow.com/questions/44785961/compile-pdf-in-rstudio-works-but-knit2pdf-does-not-work-in-r-or-rstudio On Windows, texi2pdf looks for the texify.exe of Miktex, but looks in a very wrong place: > Sys.which("texify") texify
2010 Apr 02
2
compare multiple values with vector and return vector
Dear all, I have a vector, and for each element I want to check whether it is equal to any element from another vector. I want a vector of logical values with the length of the first one as return. In R this would be : > x <- 1:10 > sapply(x,function(y){any(y==c("2","3","4"))}) [1] FALSE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE It works pretty
2017 Mar 28
0
`[` not recognized as a primitive in certain cases.
Thank you gents, I overlooked the subtle differences. On Tue, Mar 28, 2017 at 2:49 PM, Lukas Stadler <lukas.stadler at oracle.com> wrote: > ?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
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 May 23
2
help pages base R not rendered correctly?
Hi all, Don't know if this is a known issue, but I couldn't find anything so I report anyway. When checking eg ?qr in both RStudio and the naked R IDE, the help page is rendered incorrectly. More specifically, any use of \bold{...} is printed as is, rather than interpreted as bold. Same happens on ?svd. According to the manual Writing R Extensions, this should still be recognized. When I