similar to: findInterval(), binary search, log(N) complexity

Displaying 20 results from an estimated 5000 matches similar to: "findInterval(), binary search, log(N) complexity"

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 >
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 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
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 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
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
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
2009 Jul 17
1
Arules questions. I need some help please
Question 2a) I am also working with arules package and I have the following problem let suppose the matrix b like: b<-matrix(c(1,1,1,1,1,1,0,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1),nrow=6) rownames(b)=c("T1", "T2", "T3", "T4", "T5", "T6") colnames(b)=c("It1", "It2", "It3", "It4") bt<-as(b,
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 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 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
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 <-
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 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.
2002 Jul 06
3
Changing journaling mode on root / loop-aes
EXT3 developers: I am curious, if EXT3 is currently being used on the root partition in "data=ordered" mode (the default as I understand), and I want to have the it come up in data=journal mode, how do you effectuate this conversion? I would also be curious how to know if anything special is required for doing so for the /boot partition as well. I believe that with the /home partition,
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,]
2001 Jul 25
4
EXT3 Worries
Dear Sir or Ma'am: I am interested to think about implementing EXT3 onto my servers here. However, I have some concerns and am hoping someone can address them. 1) If I install ext3 what is the likelihood that the extent of damage caused by its bugs will be limited to just the fact that the journals may not work properly? Alternatively, do I risk real damage to files and the filesystem at
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