Displaying 7 results from an estimated 7 matches for "kaskelma".
2008 Aug 18
2
ifelse
I find it slightly surprising, that
ifelse(TRUE, character(0), "")
returns NA instead of character(0).
[WNT 2.6.2 Patched]
--
Heikki Kaskelma
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
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
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