Displaying 20 results from an estimated 1000 matches similar to: "help with rle function on paired data"
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 a data.frame
it seems that
rle.df <-
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])
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 function rle() may
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
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
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
2011 Sep 26
1
How to Store the executed values in a dataframe & rle function
Hi group,
This is how my test file looks like:
Chr start end sample1 sample2
chr2 9896633 9896683 0 0
chr2 9896639 9896690 0 0
chr2 14314039 14314098 0 -0.35
chr2 14404467 14404502 0 -0.35
chr2 14421718 14421777 -0.43 -0.35
chr2 16031710 16031769 -0.43 -0.35
chr2 16036178 16036237 -0.43 -0.35
chr2 16048665 16048724 -0.43 -0.35
chr2 37491676 37491735 0 0
chr2 37702947 37703009 0 0
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)
2011 Aug 18
2
Selecting subset of factor levels
Dear r-help,
I would like to select a subset of levels from a factor variable in a data frame and return a data frame.
The data set consists of 3 variables, 2 of which are factors (Site, Fish) and one numeric (Datavalue) as follows:
Site Fish Datavalue
AB 2-1 2.3
AB 2-1 2.4
AB 2-1 2.2
AB 2-2 2.6
AB 2-2 2.5
AB 2-2 2.7
AB 2-3
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]]
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")
2005 Jun 24
1
r programming help II
Dear List,
Suppose we have a variable K.JUN defined as (with
1=wet, 0=dry):
K.JUN1984 = c(1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
K.JUN1985 = c(0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1)
K.JUN1986 = c(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1)
2012 Aug 01
0
how to use function of rle approx ifelse etc. in data frame
Hello R help,
I have this data frame M2[160000,5] with NAs, a simple example would be:
set.seed(1234)
M2<-expand.grid(ID=182:183, year=2012, month=1:3, day=1:3,
KEEP.OUT.ATTRS=FALSE)
M2 <- M2[with(M2, order(ID, year, month, day)),] #sort the data
M2$value <- sample(c(NA, rnorm(100)), nrow(M2),
prob=c(0.5, rep(0.5/100, 100)), replace=TRUE)
M2:
ID year month day
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?
2000 Dec 13
1
Patents
I suppose it could be possible to patent something and
let the patent expire so that it is registered at the
patent office but not enforcable. No one else could
patent it then.
I get curious about the RLE patent. I heard Someone
has a patent on run length encoding and I wonder how
long they have had it because I remember RLE code
running on a sinclair spectrum in the 80's before the
whole
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
2015 Aug 21
2
[PATCH 2/2] core/graphics: fix lss16 parsing
getnybble() needs to return four bits at a time from every byte.
During rle decode, rows are rounded to an integer number of bytes.
The rle length needs to be able to hold values > 255.
Signed-off-by: Chas Williams <3chas3 at gmail.com>
---
core/graphics.c | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/core/graphics.c
2010 Jan 27
3
Function for describing segements in sequential data
Dear R-users,
Say that I have a sequence of zeroes and ones:
x <- c(1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0)
The sequences of ones represent segments and I want to report the starting and endpoints of these segments. For example, in 'x', the first segment starts at location 1 and ends at 3, and the second segment starts at location 8 and ends at location 10. Is there an efficient
2005 Jan 31
2
mass user creation
Hi,
i plan to mass creat user in ldap to use with samba
I tried with ldiff like the structure below, the user is created but no
home directory is created, user in not member on any groups.
1) how to do with ldiff file to put a user member of a group ?
So i plan to use smbldap-useradd => home drectorie is created with the
appropriated rights, user is member of "Domain Users" :
2008 Aug 02
2
lapply, sapply
Hello everybody,
I have problem with a lapply command, which rather proves that I don't
fully understand it.
I want to extract from a list that consists of dataframes, the length
of the first sequences from a given variable (its part of a simulation
exercises).
Below is code which does the job, but I think it should be possible to
make it more compact.
### Example Data
dat <-list()