Displaying 20 results from an estimated 360 matches for "rle".
Did you mean:
re
2005 Jun 24
1
r programming help II
...993,K.JUN1994,K.JUN1995,K.JUN1996,K.JUN1997,K.JUN1998,K.JUN1999,K.JUN2000,K.JUN2001,K.JUN2002)
Our motivation is to count number of wet days (1's) in
each weeks. But counting number of wet days for entire
K.JUN will not do.
Thus in r console,
> k<-0;j<-0;i<-(1:7)+30*j+7*k;K.JUN[i];rle(K.JUN[i])
[1] 1 0 1 1 1 1 1
Run Length Encoding
lengths: int [1:3] 1 1 5
values : num [1:3] 1 0 1
where k=0,1,2,3 for each j=0 to 18 (k indicating weeks
of any June, and j indicates years 1984-2002
respectively).
Now we need to sum the run 'lengths' corresponding to
each 'values...
2012 Oct 16
2
cannot coerce class '"rle"' into a data.frame
why?
> rle
Run Length Encoding
lengths: int [1:1650061] 2 2 8 2 4 5 6 3 26 46 ...
values : chr [1:1650061] "4bbf9e94cbceb70c BG bg" "4fbbf2c67e0fb867 SK sk" ...
> as.data.frame(rle)
Error in as.data.frame.default(vertices.rle) :
cannot coerce class '"rle"' into...
2011 Jun 17
3
rle on large data . . . without a for loop!
I think need to do something like this:
dat<-data.frame(state=sample(id=rep(1:5,each=200),1:3, 1000,
replace=T,prob=c(0.7,0.05,0.25)),V1=runif(1,10,1000),V2=rnorm(1000))
rle.dat<-rle(dat$state)
temp<-1
out<-data.frame(id=1:length(rle.dat$length))
for(i in 1:length(rle.dat$length)){
temp2<-temp+rle.dat$length[[i]]
out$V1[i]<-mean(dat$V1[temp:temp2])
out$V2[i]<-sum(dat$V2[temp:temp2])
out$state[i]<-rle.dat$value[[i]]
temp<-temp2
}
to a very...
2013 Mar 26
2
Feed rle() output to hist()
I want to make a histogram from the lengths vector which is part of the
output of rle. But I don't know how to access that vector so that I use it
as an argument of hist(). What argument must I use so that I use the
lengths vector as an input to hist()?
Example output is:
Run Length Encoding
lengths: int [1:4] 1 2 3 3
values : num [1:4] -1 1 -1 1
A printout of the funct...
2011 Jun 23
3
problem (and solution) to rle on vector with NA values
Hello there R-help,
I'm not sure if this should be posted here - so apologies if this is the case.
I've found a problem while using rle and am proposing a solution to the issue.
Description:
I ran into a niggle with rle today when working with vectors with NA values
(using R 2.31.0 on Windows 7 x64). It transpires that a run of NA values
is not encoded in the same way as a run of other values. See the following
example as an illus...
2009 Jul 07
2
rle
Hallo,
I have an other problem, I have this vector signData with an alternation of
1 and -1 that corrispond to the duration of two different percepts. I
extracted the durations like this:
signData<- scan("dataTR10.txt")
dur<-rle(signData)$length
Now I would like to extract only the positive duration, e.g.
signData <- c(1,1,1,1,-1,-1,-1,1,1,-1,-1)
posduration <- c(4,2)
I think I should use rle in a nested way, this is what I tried but it
doesn't work:
posduration<- rle(signData[=1])$length
Could you plea...
2012 Jun 08
2
help with rle function on paired data
Dear R Community - I hope you might be able to provide some guidance
regarding the use of the rle function. I have a set of time-series data
where a measured value is recorded every 30 seconds after the start of an
experiment. Many of the measured values repeat and I am interested only in
the values when there is a change. If I turn the measured values into a
vector, the rle function works perf...
2008 May 27
4
help with simple function
I have a matrix of frequency counts from 0-160.
x<-as.matrix(c(0,1,0,0,1,0,0,0,1,0,0,0,0,1))
I would like to apply a function creating a new column (x[,2])containing
values equal to:
a) log(x[m,1]) if x[m,1] > 0; and
b) for all x[m,1]= 0, log(next x[m,1] > 0 / count of preceding zero values
+1)
for example, x[1,2] should equal log(x[2,1]/2) = log(1/2) = -0.6931472
whereas x[3,2] should
2011 Sep 28
0
Rle function to expand for many samples
Dear R experts,
code:
>m<-read.table("test.txt",sep='\t',header=TRUE,colClasses=c('character','integer','integer','rep('numeric',150))
> s<-data.frame(c(rle(m$Sample1)[[2]],rle(m$Sample2)[[2]],rle(m$Sample3)[[2]]),c(rle(m$Sample1)[[1]],rle(m$Sample2)[[1]],rle(m$Sample3)[[1]]))
> names(s)=c("Values","Probes")
#Suppose the test file looks like with ofcourse more samples with values:
Chr Start End Sample1 Sample2 Sample3
chr2 98966...
2002 May 20
1
how does one apply Western Electric / AT&T rules to R plots?
I have searched for info on how to apply the Western Electric rules for
process control, to data and plots I have in R, but I have not been able
to learn how.
Any help would be greatly appreciated.
Thank you,
sjcrauhut at agere.com
05/20/02
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2020 Aug 26
1
NAs and rle
Hi All,
A twitter user, Mike fc (@coolbutuseless) mentioned today that he was
surprised that repeated NAs weren't treated as a run by the rle function.
Now I know why they are not. NAs represent values which could be the same
or different from eachother if they were known, so from a purely conceptual
standpoint there is no way to tell whether they are the same and thus
constitute a run or not.
This conceptual strictness isnt universall...
2005 Oct 26
3
splash screen
Is the splash screen RLE is standard 640x480x4 or a modified one
because I can neither open the file in Photoshop CS2 (Windows under
ext2fsd) or Gimp 2.2 (Linux 2.6.12.16ubuntu) and I am unable to
decipher Perl scripts. Will syslinux support standard RLE?
2011 Sep 26
1
How to Store the executed values in a dataframe & rle function
...e among the common values and probes is number of
similar values.
Code:
>m<-read.table("test.txt",sep='\t',header=TRUE,colClasses=c('character','integer','integer','numeric','numeric'))
#reading the test file
>s<-data.frame(c(rle(m$Sample1)[[2]],rle(m$Sample2)[[2]]),c(rle(m$Sample1)[[1]],rle(m$Sample2)[[1]]))
# to get the last 2 columns
> names(s)=c("Values","Probes")
>G=1
> for(i in 1:length(s$Probes)){
+ if(G==1){first<-unique(m$Chr[G:s$Probes[i]])
+ second<-min(m$Start[G:s$Probes[...
2011 Oct 31
2
rle for non concecutive
Dear all,
I would like to task you if you know a rle version that can work also in a non consecutive way too.
B.R
Alex
[[alternative HTML version deleted]]
2001 Apr 03
1
rle() fails with NA's (PR#892)
Full_Name: Jeff Hallman
Version: 1.2.2
OS: Solaris
Submission from: (NULL) (132.200.32.33)
> rle(c(1, NA, 1)
$lengths
[1] 3
$values
[1] 1
should be as in Splus:
$lengths
[1] 1 1 1
$values
[1] 1 NA 1
The Splus implementation (which works fine in R) is:
rle <- function(x){
if(!is.atomic(x))
stop("Argument must have an atomic mode")
if(length(x) == 0)
return(list(len...
2010 May 26
3
Peak Over Threshold values
Dear List
I hope you can help me: I?ve got a dataframe (df) within which I am looking
for Peak Over Threshold values as well as the length of the events. An event
starts when walevel equals 5.8 and it should end when walevel equals the
lower threshold value (5.35).
I tried ?clusters (?)? from ?evd package?, and varied r (see example) but it
did not work for all events (again
2009 Nov 11
2
partial cumsum
Hello,
I am searching for a function to calculate "partial" cumsums.
For example it should calculate the cumulative sums until a NA appears,
and restart the cumsum calculation after the NA.
this:
x <- c(1, 2, 3, NA, 5, 6, 7, 8, 9, 10)
should become this:
1 3 6 NA 5 11 18 26 35 45
any ideas?
thank you and best regards,
stefan
2007 Oct 09
3
identify number of sequences from a vector
? stato filtrato un testo allegato il cui set di caratteri non era
indicato...
Nome: non disponibile
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071009/365764b4/attachment.pl
2008 Jun 07
3
favorite useful tools?
Hi,
I'm relatively new to R, so I don't know the full list of base (or
popular add-on packages) functions and tools available. For example, I
tripped across mention of rle() in a message about some other problem.
rle() turned out to be a handy shortcut to splitting some of my data by
magnitude (vaguely like a sequence-based histogram).
So I thought I'd ask: what small, or obscure, tools and functions in R
do you find handy or 'cool' to use in your work...
2013 Jan 27
1
bug and enhancement to split?
...ind <- .Internal(split(seq_along(f), f))
+ ind <- .Internal(split(seq_along(x), f))
for(k in lf) y[[k]] <- x[ind[[k]]]
y
}
Maybe a little harder to argue the following, but in split.default, for a class
that one might wish to develop factor-like behaviour, e.g.,
Rle = setClass("Rle", representation(values="integer", lengths="integer"))
f = Rle(values=1:2, lengths=2:3)
the code
if (is.list(f))
f <- interaction(f, drop = drop, sep = sep)
else if (drop || !is.factor(f))
f <- factor(f)
requires...