similar to: findInterval(all.inside=TRUE) for degenerate 'vec' arguments

Displaying 20 results from an estimated 10000 matches similar to: "findInterval(all.inside=TRUE) for degenerate 'vec' arguments"

2008 Sep 22
1
findInterval(), binary search, log(N) complexity
Dear R users, the help for findInterval(x,vec) suggests a logarithmic dependence on N (=length(vec)), which would imply a binary search type algorithm. However, when I "test" this hypothesis, in the following manner: set.seed(-3645); l <- vector(); N.seq <- c(5000, 500000, 1000000, 10000000, 50000000);k <- 1 for (N in N.seq){ tmp <- sort(round(stats::rt(N, df=2), 2));
2020 Mar 05
3
findInterval Documentation Suggestion
I've found over time that R documentation that comes off as terse at first blush is usually revealed to be precise, concise, and complete on close reading.? I'm sure this is also true of `?findInterval`, but for whatever reason my brain simply refuses to extract meaning from it. Part of the problem may be that we interact with the function via a compressed form of the bounds of the
2020 Mar 06
0
findInterval Documentation Suggestion
>>>>> brodie gaslam via R-devel >>>>> on Thu, 5 Mar 2020 22:18:33 +0000 (UTC) writes: > I've found over time that R documentation that comes off as terse at > first blush is usually revealed to be precise, concise, and complete > on close reading.? I'm sure this is also true of `?findInterval`, but > for whatever reason my
2010 Jul 12
2
findInterval and data resolution
Hello Wise Ones... I need a clever way around a problem with findInterval. Consider: vec1 <- 1:10 vec2 <- seq(1, 10, by = 0.1) x1 <- c(2:3) a1 <- findInterval(x1, vec1); a1 # example 1 a2 <- findInterval(x1, vec2); a2 # example 2 In the problem I'm working on, vec* may be either integer or numeric, like vec1 and vec2. I need to remove one or more sections of this vector;
2011 Apr 04
2
General binary search?
Is there a generic binary search routine in a standard library which a) works for character vectors b) runs in O(log(N)) time? I'm aware of findInterval(x,vec), but it is restricted to numeric vectors. I'm also aware of various hashing solutions (e.g. new.env(hash=TRUE) and fastmatch), but I need the greatest-lower-bound match in my application. findInterval is also slow for
2011 Apr 15
1
[Rcpp-devel] Find number of elements less than some number: Elegant/fastsolution needed
On Thu, Apr 14, 2011 at 7:02 PM, <rcpp-devel-request at r-forge.wu-wien.ac.at> wrote: > I was able to write a very short C++ function using the Rcpp package > that provided about a 1000-fold increase in speed relative to the best > I could do in R. ?I don't have the script on this computer so I will > post it tomorrow when I am back on the computer at the office. > >
2011 Jun 03
1
VLOOKUP in R - tried everything.
I am attempting to emulate the VLOOKUP function from Excel in R. I want to compare one column (coll.minus.release) with another (release.days) to get the number of parasitoid released at that time (TotalParasitoids). for example: coll.minus.release release.days ParasitoidTotal -12 -266 1700 8 -259 1000 8
2011 Dec 06
1
help wrapping findInterval into a function
Dear R Community, I hope you might be able to assist with a small problem creating a function. I am working with water-quality data sets that contain the concentration of many different elements in water samples. I need to assign quality-control flags to values that fall into various concentration ranges. Rather than a web of nested if statements, I am employing the findInterval function to
2012 Jan 21
2
Función para encontar intervalo
Cordial saludo. Estoy construyendo una funcion que busca en que intervalo de un vector dado se encuentra cada entrada de otro vector, busca la posicion hasta la cual la intrada "i" (i-> 1 a 1000) del vector "vec" no es mayor que la entrada "k" del vector "ic", la idea es encontrar entre que valores del vector "ic" se encuentra cada intrada del
2018 Nov 29
2
named arguments discouraged in `[.data.frame` and `[<-.data.frame`
Thanks Bill and Michael for taking the time to share your knowledge! As a further background to my question, here are two examples that I forgot to include in my original post (reminded by Michael's answer). I swapped the i and j arguments in `[.data.frame` and `[<-.data.frame`. With warnings, but else without (?) problem. Using Bill's data: `[.data.frame`(x = d, i = 1, j = 2) # [1]
2011 Jan 25
0
Map an Area to another
Dear All, I would like to ask you help with the following: Assume that I have an area of 36 cells (or sub-areas) sr<-matrix(data=seq(from=1,to=36),nrow=6,ncol=6,byrow=TRUE) > sr [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1 2 3 4 5 6 [2,] 7 8 9 10 11 12 [3,] 13 14 15 16 17 18 [4,] 19 20 21 22 23 24 [5,] 25 26 27 28 29 30 [6,]
2004 Sep 20
1
findInterval in compiled code.
Hi all, I am writing some C code where I want to use the findInterval function documented in "Writing R extensions/Utility functions". i.e. the C-version not the R version. It all compiles but the shared library is causing seg-faults and I'm obviously stuffing something up. Has anyone got any examples of calling this function they'd be will to share? I've searched through
2011 Jan 26
0
Fwd: MAtrix addressing
Begin forwarded message: > From: David Winsemius <dwinsemius at comcast.net> > Date: January 26, 2011 8:32:30 AM EST > To: Alaios <alaios at yahoo.com> > Subject: Re: [R] MAtrix addressing > > > On Jan 26, 2011, at 7:58 AM, Alaios wrote: > >> Unfortunately right now is convoluted... by I was trying to find >> some solution. >> Bring again
2012 Oct 08
1
Diagnostic testing in a VEC
Hi everyone, I'm using the Johansen framework to determine a VEC using package urca. I have estimated the corresponding VEC using likelihood ratio test for restrictions on alpha, beta or both and I have generated objects of the class cajo.test. Now I want to diagnostic tests in the model, like heteroskedasticity test, residuals normality and serial autocorrelation, but I cannot find the way
2018 Nov 28
3
named arguments discouraged in `[.data.frame` and `[<-.data.frame`
tl;dr: Why are named arguments discouraged in `[.data.frame`, `[<-.data.frame` and `[[.data.frame`? (because this question is of the kind 'why is R designed like this?', I though R-devel would be more appropriate than R-help) ############################# Background: Now and then students presents there fancy functions like this:
2011 Feb 17
2
does range of values in array include a third value?
I'm using the range command to get the minimum and maximum values of an array as in x <- range(array_y) which gives me two values such as [1] -2 9 I need to be able to test if this range of values includes a third value. For example I'd like to query 1) does the range of -2 to 9 include 3, answer TRUE 2) does the range of -2 to 9 include -6, answer FALSE? All values could be
2013 Sep 13
2
how to get values within a threshold
input: > values [1] 0.854400 1.648465 1.829830 1.874704 7.670915 7.673585 7.722619 > thresholds [1] 1 3 5 7 9 expected output: [1] 1 4 4 4 7 That is, need a vector of indexes of the maximum value below the threshold. e.g. First element is "1", because value[1] is the largest below threshold "1". Second element is "4", because value[4] is the
2018 Nov 28
0
named arguments discouraged in `[.data.frame` and `[<-.data.frame`
They can get bitten in the last two lines of this example, where the 'x' argument is not first: > d <- data.frame(C1=c(r1=11,r2=21,r3=31), C2=c(12,22,32)) > d[1,1:2] C1 C2 r1 11 12 > `[`(d,j=1:2,i=1) C1 C2 r1 11 12 Warning message: In `[.data.frame`(d, j = 1:2, i = 1) : named arguments other than 'drop' are discouraged > `[`(j=1:2,d,i=1) Error in (1:2)[d, i =
2018 Nov 29
0
named arguments discouraged in `[.data.frame` and `[<-.data.frame`
Well, the situation with `[.data.frame` (and [<-) is complicated by the fact that the data.frame-method is not a primitive, but the generic IS. I'm not sure about dispatch for primitive-generics, but I bet it's done on the first argument (as with S3). Which means `[`(j=1:2,d,i=1) has nothing to do with `[.data.frame`, as some internal code equivalent to something like `[.integer` is
2012 Oct 05
1
svyhist
Hello, I was trying to draw histograms of age at death and got the following 2 error messages: 1) Error in tapply(1:NROW(x), list(factor(strata)), function(index) { : arguments must have same length 2) Error in findInterval(mm[, i], gx) : 'vec' contains NAs In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) :