similar to: ifelse

Displaying 20 results from an estimated 900 matches similar to: "ifelse"

2007 Feb 01
3
Can this loop be delooped?
Hi. I have the following code in a loop. It splits a vector into subvectors of equal size. But if the size of the original vector is not an exact multiple of the desired subvector size, then the first few subvectors have one more element than the last few. I know that the cut function could be used to determine where to break up the vector, but it doesn't seem to provide control over
2008 Feb 21
3
applying a function to data frame columns
useR's, I want to apply this function to the columns of a data frame: u[u >= range(v)[1] & u <= range(v)[2]] where u is the n column data frame under consideration and v is a data frame of values with the same number of columns as u. For example, v1 <- c(1,2,3) v2 <- c(3,4,5) v3 <- c(2,3,4) v <- as.data.frame(cbind(v1,v2,v3)) uk1 <- seq(min(v1) - .5, max(v1) + .5,
2008 Jul 01
1
[.data.frame speedup
Below is a version of [.data.frame that is faster for subscripting rows of large data frames; it avoids calling duplicated(rows) if there is no need to check for duplicate row names, when: i is logical attr(x, "dup.row.names") is not NULL (S+ compatibility) i is numeric and negative i is strictly increasing "[.data.frame" <- function (x, i, j,
2007 Feb 28
2
delete selecting rows and columns
Hi, I'm working with a big square matrix (15k x 15k) and I have some trouble. I want to delete selecting rows and columns. I'm using something like this: > sel_r=c(15,34,384,985,4302,6213) > sel_c=c(3,151,324,3384,7985,14302) > matrix=matrix[-sel_r,-sel_c] but it works very slow. Does anybody know how to make it in faster way? Thank's -- View this message in context:
2008 Feb 29
2
while loop syntax help
Dear list, I'm trying to write my first looping function in R. After many hours of searching help files and previous posts, I'm at wits end. Please forgive my programming ignorance...any help is greatly appreciated. I need to sort through a vector (x) and identify the point at which 2 successive values become smaller than the previous value. I've written a "while"
2007 Jan 18
4
How to optimize this loop ?
Dear R Users, I request your help to optimize a loop. Given a series of observations, I want to know how many consecutive past observations are below the last one. e.g : my_series <- c(3, 4, 10,14,8,3,4,6,9) As the last number (9) is higher than the four preceding numbers (6, 4, 3, 8), this function should return 4. my_series <- c(3, 4, 10,14,8,3,4,11,9) Here, it should return 0, as 9
2016 Aug 06
4
ifelse() woes ... can we agree on a ifelse2() ?
Dear R-devel readers, ( = people interested in the improvement and development of R). This is not the first time that this topic is raised. and I am in now state to promise that anything will result from this thread ... Still, I think the majority among us has agreed that 1) you should never use ifelse(test, yes, no) if you know that length(test) == 1, in which case if(test) yes
2011 Aug 30
4
weird apply() behavior
Hi, I had a weird results from using apply(). Here is an simple example: > y<-data.frame(list(a=c(1,NA),b=c('2k','0'))) > y ??? a???? b 1? 1?? 2k 2 NA?? 0 > apply(y,1,function(x){x<-unlist(x); if (!is.na(x[2]) & x[2]=='2k' & !is.na(x[1]) & x[1]=='1') 1 else 0} ) This should print "1 0" as output, as demonstrated by: >
2006 Nov 13
2
indexing question
I have the following set of indices, call it idx, that correspond to the indices of a vector say temp. [1] 31 36 41 61 66 71 91 96 101 121 126 131 151 156 161 181 186 191 211 216 221 241 246 251 271 276 281 301 306 311 331 336 341 361 366 [36] 371 391 396 401 421 426 431 451 456 461 481 486 491 511 516 521 541 546 551 571 576 581
2006 Mar 30
2
help : No database specified. Missing argument: database.
Hi, I''m new to Ruby programming. I''m wnt thru the example by curt in onlamp and was stuck up in the midst of configuration. I''m getting the "No database specified. Missing argument: database." error when i tried creating a table recipe in cookbook db . My database.yml contains the following entries Development: adapter:mysql host:127.0.0.1
2001 Feb 07
2
Undefined symbols
Where could I get information about wine libraries content ? For instance, if I'm migrating a WNT console based application using winelib, which is the library I must link with object files ? I don't have this information. Thanks in advance. Ignasi Villagrasa.
2002 Oct 03
5
Port 139 versus Port 445
I've noticed that my W2K clients connect to Samba much more quickly if I run it on port 445 instead of 139. However, my WNT clients then won't connect at all. I read somewhere that it was possible to forward the requests on port 139 to port 445. Anyone know how to do this or how to listen to both ports simultaneously? Thanks, Jason Joines Open Source = Open Mind
2010 Mar 25
1
*** caught segfault *** address 0x18, cause 'memory not mapped'
Hello R Community, I've been run the following codes. However, I've been getting an unusual segfault that I'm unable to trace its origin. Please give me a light to decipher the "caught segfault" Thanks for you attention. Bernardo. > options(STERM='iESS', editor='emacsclient') > rm(list = ls()) > > source("fgenIGLD.R") #RNG
2011 May 01
2
Question on where samples are grouped in rmvnorm{mvtnorm}
Dear All, For function: rmvnorm{mvtnorm} in (library mvtnorm, not splus2R), if I generate 2 bivariate normal samples as follows: > rmvnorm(2,mean=rep(0,2),sigma=diag(2)) [,1] [,2] [1,] 2.0749459 1.4932752 [2,] -0.9886333 0.3832266 Where is the first sample, it is stored in the first row or the first column? Does this function store samples row-wise or column-wise? Thank
2009 Oct 07
1
inconsistency in return value of peaks() {splus2R} (PR#13988)
Full_Name: Benny van der Vijgh Version: 2.7.2 OS: Windows Vista Submission from: (NULL) (194.171.252.108) The return value of peaks() in package splus2R is not consistent. This is because of the call to max.col() without additional parameters which peaks() makes. max.col() has a parameter 'ties.method' which specifies how ties are handled, with "random" by default. This means
2012 Mar 05
4
[LLVMdev] commit r152019 broke architectures with more than 255 registers
Our architecture(TCE) can have LOTS of registers. It seems r152019 changed some register bookkeeping data structures to 8-bit. This broke support for architectures with >255 registers. Please revert this change or make those register-related values at least 16 bits wide.
1998 Sep 28
3
file names in Win Explorer
I'm having a problem getting W95 and WNT to correctly read file names on a samba server I set up. The server passed all of the diagnostics, and file names show up correctly in a dos window. However, under windows explorer, anything after a . doesn't show up in the name. This is only true for a . in the middle of the name, "hidden" files such as .fvwmrc show up. WE does
2010 Oct 01
2
[LLVMdev] Illegal optimization in LLVM 2.8 during SelectionDAG? (Re: comparison pattern trouble - might be a bug in LLVM 2.8?)
On 1 Oct 2010, at 13:35, Bill Wendling wrote: > On Sep 30, 2010, at 2:13 AM, Heikki Kultala wrote: > >> Bill Wendling wrote: >>> On Sep 29, 2010, at 12:36 AM, Heikki Kultala wrote: >>> >>>> On 29 Sep 2010, at 06:25, Heikki Kultala wrote: >>>> >>>>> Our architecture has 1-bit boolean predicate registers. >>>>>
2010 Oct 04
2
[LLVMdev] Illegal optimization in LLVM 2.8 during SelectionDAG
Bill Wendling wrote: > On Sep 30, 2010, at 2:13 AM, Heikki Kultala wrote: > >> Bill Wendling wrote: >>> On Sep 29, 2010, at 12:36 AM, Heikki Kultala wrote: >>> >>>> On 29 Sep 2010, at 06:25, Heikki Kultala wrote: >>>> >>>>> Our architecture has 1-bit boolean predicate registers. >>>>> >>>>> I've
2009 Apr 24
1
Mount Openfiler created XFS volumes
Greetings, I have a 500Gig hdd with and XFS filesystem created by openfiler (which strangely switched from lovely CentOS for reasons best known to them). I fired up a Centos box with this hdd. I then did yum install kmod-xfs.i686 xfsdump.i386 dmapi xfsprogs and it wnt through. But when I try to mount this volume mount -t xfs /dev/hdd1 /mnt/test I get the error: mount: /dev/hdd1 already