similar to: help wrapping findInterval into a function

Displaying 20 results from an estimated 900 matches similar to: "help wrapping findInterval into a function"

2010 Feb 01
1
Comparing Variables and Writing a New Column
HI, I am using Windows XP and R version 2.9.2. I have a data frame written by R similar to the following: Lab_ID Analysis_Soil Results -4MAD -2.5MAD +2.5MAD +4MAD 55003 Calcium-2008-116 900 961 1121.5 1656.5 1817 55003 Calcium-2008-117 3321 2175 2380.5 3065.5 3271 55003
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 >
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;
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
2005 Sep 08
4
Prediction with multiple zeros in the dependent variable
I have a batch of data in each line of data contains three values, calcium score, age, and sex. I would like to predict calcium scores as a function of age and sex, i.e. calcium=f(age,sex). Unfortunately the calcium scorers have a very "ugly distribution". There are multiple zeros, and multiple values between 300 and 600. There are no values between zero and 300. Needless to say, the
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
2008 May 27
1
Fwd: Re: Seeking help with trellis: log scales on xyplot
Deepayan: Sorry for the additional email, but I'm concerned that I wasn't being clear. In the end, I would like a graphic that portrays my y-values on a log scale in their native data range. That is to say, I would prefer to see the axis labels as 1000 rather than 3 (log10 of 1000). Thank you for your kind assistance, Hobie Perry St. Paul, MN Hobie Perry <hobie_perry@yahoo.com>
1998 Dec 09
2
Application Error message
I am submitting the command: calcium<-read.table("calcium.txt",header=TRUE) and with Rw0630 and Bdr0631 I get an application error and R crashes. But the command works fine with rjune. I am running under NT4.0 Anyone have a similar problem? Jeff jmorris at ocdus.jnj.com -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
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
2012 Oct 19
1
Optimization in R similar to MS Excel Solver
Dear Colleagues, I am attempting to develop an optimization routine for a river suspended sediment mixing model. I have Calcium and Magnesium concentrations (%) for sediments from 4 potential source areas (Topsoil, Channel Banks, Roads, Drains) and I want to work out, based on the suspended sediment calcium and magnesium concentrations, what are the optimal contributions from each source area to
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
2001 Aug 28
1
Axis labels
Hi, I am trying to label the x-axis of some histograms with the units of measurement. However, when I use, for example: > truehist(Ca, prob=FALSE, col="gray", xlab=expression(paste("Calcium (", mu, eq^-1, ")"))) I get the following message: Error in eval(expr, envir, enclos) : Object "mu" not found Could someone let me know what I'm doing wrong?
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]'.
2011 Aug 30
3
Descriptive Stats from Data Frame
I don't find how to do what I need to do in Dalgaard or 'R Cookbook', so I'm asking here. I have a data frame with water chemistry data and I want to start exploring these data. There are three factors (site, date, chemical) associated with each measurement. The data frame looks like this: > summary(chemdata) site_id.sample_date.param.quant
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 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. > >