Displaying 20 results from an estimated 9000 matches similar to: "rle() fails with NA's (PR#892)"
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
2004 Oct 28
1
Internal function isUME() in findGeneric() is wrong (PR#7320)
Full_Name: Jeff Hallman
Version: 2.0
OS: Linux
Submission from: (NULL) (132.200.32.34)
The function findGeneric() in the utils namespace contains this internal
function:
isUME <- function(e) {
if (is.call(e) && (is.name(e[[1]]) || is.character(e[[1]]))) {
switch(as.character(e[[1]]), UseMethod = as.character(e[[2]]),
"{" =
2006 Jun 13
1
format.POSIXlt drops characters following percent sign (PR#8975)
Full_Name: Jeff Hallman
Version: 2.3.1
OS: Windows
Submission from: (NULL) (132.200.32.34)
Internal(format.POSIXlt(as.POSIXlt(Sys.time()), "%Y%m%d%q", F))
Linux R-2.2.1 returns "20060613%q".
Windows R-2.3.1 returns "20060613" dropping the "%q".
The documentation says "Any character in the format string other that the '%'
escape
2001 Mar 30
1
User defined assignment function ignores argument names (PR#888)
Full_Name: Jeff Hallman
Version: 1.2.2
OS: Solaris
Submission from: (NULL) (132.200.32.33)
"boink<-" <- function(x, a = 1, b = 2, value){
print(match.call())
x
}
> z <- 1
> boink(z, b = 4) <- 22
boink<-(x = *tmp*, a = 4, value = 22)
>
Shouldn't it have matched the 4 to b, not a?
2009 Aug 17
4
Calling C functions with value parameters
One hassle I could do without is the necessity of writing C wrapper functions
like this:
void fameInit(int *status){
cfmini(status);
return;
}
when I want to call a library function (cfmini, in this case) that takes an
int argument. The .C interface only lets me pass a pointer to an int, rather
than the int itself.
Is there any chanch that .C could be enhanced to allow passing arguments by
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
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
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])
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
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
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
2008 Jan 04
5
I need arguments pro-S-PLUS and against SAS...
I need arguments pro-S-PLUS and against SAS for a meeting I will
have next week. S-Plus is (90 - 99)% compatible with R, so using
S-Plus will make things much easier for everyone. But I can't use
this argument. What other arguments could I use?
Alberto Monteiro
2006 Jun 20
1
Packaging platform-specific functions
I have a few functions, such as screenWidth() and screenHeight(), which
I have been able to implement for a Unix/Linux environment, but not for
Windows. (Does anyone know how to find the screen dimensions in
Windows?)
The Writing R Extensions manual tells me how to include
platform-specific sections in documentation, and even how to have
platform-specific help files. But it doesn't say
2009 Jun 02
2
Adding a method to a generic in another package
I am the maintainer of the 'tis' package. One of the functions in my package
is 'nberShade'. A user wants to make nberShade generic, with the old version
renamed as nberShade.default, all of which is fine with me. And he wants to
add a new method, nberShade.ggplot, which works for objects of class ggplot.
He also wants to add a method fortify.tis for the generic fortify defined
2010 May 14
2
Subscripting a matrix-like object
I have an S3 class called "tis" (Time Indexed Series) which may or may
not have multiple columns. I have a function "[<-.tis" that I've
reproduced below.
My question is this: inside of "[<-.tis", how can I distinguish between
calls of the form
x[i] <- someValue
and
x[i,] <- someValue ?
In either case, nargs() is 3, and looking at the values
2010 May 14
2
Subscripting a matrix-like object
I have an S3 class called "tis" (Time Indexed Series) which may or may
not have multiple columns. I have a function "[<-.tis" that I've
reproduced below.
My question is this: inside of "[<-.tis", how can I distinguish between
calls of the form
x[i] <- someValue
and
x[i,] <- someValue ?
In either case, nargs() is 3, and looking at the values
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]]
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)
2006 Dec 08
2
dyn.load and function calls without 'PACKAGE' argument
I'm writing a package that interfaces to the FAME database, via a
library of compiled C routines accessible through a Linux .so file. My
.onLoad() function loads the .so like this:
dyn.load("/opt/fame/timeiq/lib/linux_x86/libjchli.so", local = F)
and after that I also load my own fame.so via
library.dynam("fame", package = "fame")
The code in fame.so uses