similar to: findInterval

Displaying 20 results from an estimated 1000 matches similar to: "findInterval"

2024 Sep 17
1
findInterval
>>>>> Gabor Grothendieck >>>>> on Mon, 16 Sep 2024 11:21:55 -0400 writes: > Suppose we have `dat` shown below and we want to find the the `y` value > corresponding to the last value in `x` equal to the corresponding component > of `seek` and we wish to return an output the same length as `seek` using > `findInterval` to perform the
2016 Aug 04
1
findInterval(all.inside=TRUE) for degenerate 'vec' arguments
What should findInterval(x,vec,all.inside=TRUE) return when length(vec)<=1, so there are no inside intervals? R-3.3.0 gives a decreasing map of x->output when length(vec)==1 and -1's when length(vec)==0. Would '0' in all those cases be better? > findInterval(x=c(10, 11, 12), vec=11, all.inside=TRUE, rightmost.closed=FALSE, left.open=FALSE) [1] 1 0 0 >
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
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
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;
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
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 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 Mar 14
0
funciones (findInterval, which) y simulación discreta
Tengo 2 grandes inquietudes: Necesito aplicar la función findInterval a una lista donde su componentes son matrices(32x32), cuyos intervalos se conformaron de la siguiente manera: 1er paso. # a todas las matrices se las dividió en matrices superiores e inferiores d_sup <- lapply(Matriz,function(x){data.matrix(upper.tri(x)*x)}) d_inf <-
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
2018 Apr 20
1
create multiple categorical variables in a data frame using a loop
> On Apr 19, 2018, at 1:22 PM, David Winsemius <dwinsemius at comcast.net> wrote: > > >> On Apr 19, 2018, at 11:20 AM, Ding, Yuan Chun <ycding at coh.org> wrote: >> >> Hi All, >> >> I want to create a categorical variable, cat.pfoa, in the file of pfas.pheno (a data frame) based on log2pfoa values. I can do it using the following code.
2018 Apr 19
0
create multiple categorical variables in a data frame using a loop
> On Apr 19, 2018, at 11:20 AM, Ding, Yuan Chun <ycding at coh.org> wrote: > > Hi All, > > I want to create a categorical variable, cat.pfoa, in the file of pfas.pheno (a data frame) based on log2pfoa values. I can do it using the following code. > > pfas.pheno <-within(pfas.pheno, {cat.pfoa<-NA > cat.pfoa[pfas.pheno$log2pfoa
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,]
2011 May 08
2
help with mysql and R: partitioning by quintile
Hi, I have a mysql table with fields userid,track,frequency e.g u1,1,10 u1,2,100 u1,3,110 u1,4,200 u1,5,120 u1,6,130 . u2,1,23 . . where "frequency" is the number of times a music track is played by a "userid" I need to turn my 'frequency' table into a rating table (it's for a recommender system). So, for each user, I need to categorise the frequency of tracks
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
2011 Mar 29
3
producing histogram-like plot
Hi! I have a dataset that looks like this: 0.0 14 0.0 3 0.9 12 0.73 15 0.78 2 1.0 15 0.3 2 0.32 8 ...and so on. I.e. a value between 0 and 1, and a number I would like to plot this in a histogram-like manner. I would like to have a set of bins, each 0.1 wide, and plot the sum of values in column 2 that falls within each bin. I.e, in this case I would like the first bin, 0.0, to have the
2009 Dec 10
0
Is there a variant of findInterval() such that v[i[j]] < x[j] <= v[i[j] + 1]?
In findInterval's help page, it says 'v[i[j]] <= x[j] < v[i[j] + 1]'. I'm wondering if there is a variant of it such that 'v[i[j]] < x[j] <= v[i[j] + 1]'.
2009 Apr 15
2
[LLVMdev] Error w/ Tablegen + Intrinsics
It seems that Tablegen is generating intrinsic ID's off by in DAGISel.inc In DAGISel.inc, I have the following pattern: int64_t CN1 = Tmp0->getZExtValue(); // Pattern: (intrinsic_w_chain:f32 103:iPTR, GPRF32:f32:$src0, GPRF32:f32:$src1, GPRF32:f32:$src2) // Emits: (MACRO_FMA_f32:f32 GPRF32:f32:$src0, GPRF32:f32:$src1, GPRF32:f32:$src2) // Pattern complexity = 8 cost
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