similar to: Summary: Vectorizing closest match

Displaying 20 results from an estimated 5000 matches similar to: "Summary: Vectorizing closest match"

2003 Apr 22
0
Hmisc's aregImpute segfaults R-1.7.0 under linux
Hello - When trying to use Hmisc library's aregImpute function on R 1.7.0, I got the following error -- shown here using the example code from the help page --- under both Linux and Mac OS X 10.2.5: set.seed(3) x1 <- factor(sample(c('a','b','c'),1000,T)) x2 <- (x1=='b') + 3*(x1=='c') + rnorm(1000,0,2) x3 <- rnorm(1000) y <- x2 +
2005 Jul 21
1
cut in R
Dear All, I wonder whether it is still valid to use the following R code for cut. All I have done is changed: if (is.na(breaks) | breaks < 2) to: if (is.na(breaks) | breaks < 1) so that it covers interval of 1? It seems okay for my purposes but I am not sure why R specifically does not allow break<2 to happen. Steve. cut.default<- function (x, breaks, labels =
2002 Mar 28
3
Vectorizing closest match
If anyone has a very fast vectorized method for doing the following I would appreciate some help. I want to avoid outer() to limit memory problems for very large n. Let x = real vector of length n y = real vector of length n w = real vector of length m, m typically less than n/2 but can be > n z = real vector of length m For w[i], i=1,,,m, find the value of x that is closest to w[i]. In
2006 Jul 17
3
information about a function
Hi people, I am new in this list and could not find a FAQ for it in particular, furthermore I could not find my question answered in the official R FAQ or docs. I have simply something like this: > f<-approxfun(data[,1],data[,2]) and f is: > f function (v) .C("R_approx", as.double(x), as.double(y), as.integer(n), xout = as.double(v), as.integer(length(v)),
2013 Feb 14
1
approxfun values
Readers, According to the help '?approxfun', the function can be used to obtain the interpolated values. The following test was tried: > testinterpolation<-read.csv('test.csv',header=FALSE) > testinterpolation V1 V2 1 10 2 2 20 NA 3 30 5 4 40 7 5 50 NA 6 60 NA 7 70 2 8 80 6 9 90 9 10 100 NA >
2007 Mar 15
1
How to use result of approxfun in a package?
I am working on a project where we start with start with 2 long, equal-length vectors, massage them in various ways, and end up with a function mapping one interval to another. I'll call that function "f1." The last step in R is to generate f1 as the value of the approxfun function. I would like to put f1 into a package, but without having the package redo the creation of
2007 Mar 03
0
2 bugs in max.col() (PR#9542)
Dear R-Developers, I think I found two bugs in max.col(). Ties between zeros are not broken, which might affect simulations. -Inf and Zero can be treated the same, which can give completely wrong results, e.g. when the second max is sought by replacing all maxs by -Inf. To fix max.col I do offer the C-code behind my function rowMax(), which also handles NAs and seems to be faster. However,
1997 Oct 08
0
R-alpha: dump() / dput() -- fail for "environmental" and attributed functions
Here is a simple example to show what I mean: f1 <- approxfun(1:3, 2:4) dump("f1", file="") which yields (in current development snapshot; other versions are conceptually equivalent) "f1" <- function (v) .C("approx", as.double(x), as.double(y), n, xout = as.double(v), length(v), as.integer(method), as.double(yleft),
2008 Oct 07
2
Gfxboot COMBOOT module
Hello all, i announce you the gfxboot COMBOOT module which is written in assembler. Since i didn't find as much spare time as i have hoped last weekend it is far from complete. Nevertheless the module is able to interact with the bincode ([1] and [2]) in the bootlogo cpio archive from the openSUSE 10.2 mini cd. So far it is able to call the bincode gfxboot code and setup some menu entries.
2009 Jun 18
2
Argument as.integer(NA) to a function C
Hi the list, I am writing a R function that call a C function. The C function needs integers but I do not manage to give a NA integer as argument : --- C code --- void essai(int *t){ Rprintf("\nT0=%i T1=%i T2=%i T3=%i",t[0],t[1],t[2],t[3]); } --- R --- boub <- c(1,2,3,4) .C("pour",as.integer(boub),NAOK=TRUE) # T0=1 T1=2 T2=3 T3=4[[1]] # [1] 1 2 3 4 boub <-
2005 Jun 06
1
Missing values in argument of .Fortran.
I wish to pass a vector ``y'', some of whose entries are NAs to a fortran subroutine which I am dynamically loading and calling by means of .Fortran(). The subroutine runs through the vector entry by entry; obviously I want to have it do one thing if y[i] is present and a different thing if it is missing. The way I am thinking of proceeding is along the xlines of: ymiss <- is.na(y)
2010 Dec 08
1
Newbie trying to understand $ so I can understand acf function in stats
I am trying to understand the function acf stats:::acf shows me the function I am having trouble understanding the usage "$acf" in the following acf <- array(.C(R_acf, as.double(x), as.integer(sampleT), as.integer(nser), as.integer(lag.max), as.integer(type == "correlation"), acf = double((lag.max + 1L) * nser * nser), NAOK =
2011 Sep 23
0
(Requested) caTools::runmean Patch
Dear Mr. Tuszynski, I would like to request what I believe would be a beneficial update / patch to the runmean() function in the caTools package. Consider the following R>> x = 1:100 R>> is.integer(x) [1] TRUE R>> library(caTools) R>> head(runmean(x, 5, alg="exact")) [1] 8.487983e-314 1.060998e-313 1.273197e-313 1.697597e-313 2.121996e-313 2.546395e-313
2008 Oct 07
0
splinefun gives incorrect derivs when extrapolating to the (PR#13139)
--MP_/kvy20nVajVG/n.8m=_ZjLAX Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tue, 7 Oct 2008 19:31:03 +0800 Berwin A Turlach <berwin at maths.uwa.edu.au> wrote: > The attached patch (against the current SVN version of R) implements > the latter strategy. With this patch applied, "make check > FORCE=FORCE" passes
2013 Jul 03
2
Problems with gfxboot.c32
Matt Fleming wrote: > On Wed, 03 Jul, at 09:53:32PM, Sebastian Herbszt wrote: >> gfxboot.c32 is supposed to work as expected if you put all required files >> inside the bootlogo archive. > > From reading com32/gfxboot/gfxboot.c, the code in the bootlog archive > calls *out* into a realmode section compiled into gfxboot.c32 > (realmode_callback.asm) to do things like
2008 Oct 07
0
splinefun gives incorrect derivs when extrapolating to the (PR#13138)
--MP_/Rxf/JAvsQx5JLkhZFc9Jmn4 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline G'day Greg, On Mon, 6 Oct 2008 19:50:13 +0200 (CEST) Greg.Snow at imail.org wrote: > This is a low priority bug that has been around for a while, but I > came across it again while alpha testing 2.8. Indeed, that bug must have been around since
2009 Jul 20
1
tabulate can accept NA values?
tabulate has .C("R_tabulate", as.integer(bin), as.integer(length(bin)), as.integer(nbins), ans = integer(nbins), PACKAGE="base")$ans The implementation of R_tabulate has if(x[i] != R_NaInt && x[i] > 0 && x[i] <= *nbin) and so copes with (silently drops) NA. Perhaps the .C could have NAOK=TRUE? This is useful in apply'ing tabulate to
2017 Oct 21
1
Illegal Logical Values
> On Fri, 2017-10-20 at 14:01 +0000, brodie gaslam via R-devel wrote: > > I'm thinking of this passage: > > > > > Logical values are sent as 0 (FALSE), 1 (TRUE) or INT_MIN = > > > -2147483648 (NA, but only if NAOK is true), and the compiled code > > > should return one of these three values. (Non-zero values other > > > than INT_MIN are
2001 Oct 28
0
Summary: A speed improvement challenge
Many thanks to Nick Ellis, Vadim Kutsyy, Charles Berry, and Bill Dunlap for providing thoughts and alternative solutions to the problem. I have included Nick and Charles' notes in full below and a summary of the others. Thanks also to Bill for telling me about an inconsistency in how the first argument of sample is interpreted. I had ignored this, resulting in a major bug. Each person
2013 Jul 04
0
Problems with gfxboot.c32
Am 03.07.2013 23:05, schrieb Sebastian Herbszt: > Matt Fleming wrote: >> On Wed, 03 Jul, at 09:53:32PM, Sebastian Herbszt wrote: >>> gfxboot.c32 is supposed to work as expected if you put all required >>> files >>> inside the bootlogo archive. >> >> From reading com32/gfxboot/gfxboot.c, the code in the bootlog archive >> calls *out* into a