Displaying 20 results from an estimated 10000 matches similar to: "detect subset in series"
2012 Feb 11
2
Detect numerical series
Hello,
I am struggling with detecting successive digits in a numerical series
vector.
Here is an example:
vec <- c(1, 15, 26, 29, 30, 31, 37, 40, 41)
I want to be able to detect 29, 30, 31 and 40, 41.
Then, I would like to delete the successive digits from the vector.
1, 15, 26, 29, 37, 40
Cheers
--
View this message in context:
2009 Oct 28
1
Need help locating the longest series of consecutive numbers in a matrix
I need to determine the length of the longest series of consecutive numbers
(1's to be specific) and the start time of that series. For example, in the
following sample, the first column is "time" and the second column indicates
the presence of the target behavior.
I would like a function that would return "21" as the start time and "17" as
the length.
sample
2007 Nov 14
3
How to get row numbers of a subset of rows
Hello list,
I read in a txt file using
<B<-read.table(file="data.snp",header=TRUE,row.names=NULL)
by specifying the row.names=NULL so that the rows are numbered.
Below is an example after how the table looks like using
<B[1:10,1:3]
SNP Chromosome PhysicalPosition
1 SNP_A-1909444 1 7924293
2 SNP_A-2237149 1 8173763
2010 Jan 11
2
help needed to find zero areas in a vector
Dear Helpers:
I spend more than half a day to solve this problem in R:
Let x be a vector of a string of 0s and 1s, such as
x<-c(0,0,1,1,0,0,0,0,1,1,0,0,0,0). It can be a very long vector.
How to sub vectors of 0s? In the above example, I would like get the vectors (0,0), (0,0,0,0), (0,0,0,0).
I can use which(x==0) to get the index of the 0 elements, but I don't know how to get the
2009 Dec 07
1
Subset of time observations where timediff > 60 secs
Dear list members
I have a rather large vector (part of a data frame) giving the time
(date + time, POSIXct) of observations. The times are irregular (with
both small and large jumps) but increasing, and there are several
millions of them.
I now wish to reduce my data set, so that I only have observations which
are at least (for example) 60 seconds apart. Basically, I need (all) the
indices
2012 Feb 13
2
finding and describing missing data runs in a time series
Hi -
I am trying to find and describe missing data in a time series. For instance, in the library openair, there is a data frame called "mydata":
library(openair)
head(mydata)
date ws wd nox no2 o3 pm10 so2 co pm25
1 1998-01-01 00:00:00 0.60 280 285 39 1 29 4.7225 3.3725 NA
2 1998-01-01 01:00:00 2.16 230 NA NA NA 37 NA NA NA
3 1998-01-01 02:00:00
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 Apr 12
1
making a counter of consecitive positive cases in time series
Hi all..RCounters!
I´m working with standarized time series, and i need make a counter of consecutives positves numbers to make a cumulative experimental funtion. I have x: the time series (0,1) and y: my counter, i have this for step. What is wrong?.. any can help me please!
x<-rbinom(15,1,.3)
y<-NULL;s<-0
for (i in 1: length (x))
{if (x[i]>0)
{s<-s+x[i]
s=0}
2006 Mar 23
1
subsets of vector
dear R users
I have been trying a lot to get this task accomplished but need your help.
input:
x <- c(3,3,4,4,4,4,5,7,7,0,1,1,2,2,2)
desired output
3 1 2
4 3 6
7 8 9
...
which means,
3 is repeated at index 1:2
4 is repeated at index 3:6
...
my effort has not been that good.
a <- !c(NA,diff(x));
b <- which(a==1);
a[b-1]=1;
cbind(x,a);
or
sp <-
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
2006 May 22
2
Subset a list
I have a data frame of ~200 columns and ~20,000 rows where each column
consists of binary responses (0,1) and a 9 for missing data. I am
interested in finding the columns for which there are fewer than 100
individuals with responses of 0.
I can use an apply function to generate a table for each column, but I'm
not certain whether I can subset a list based on some criterion as
subset() is
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])
2012 Aug 21
2
Sequence detection longer than a certain value
Hello,
I have 2 variable: one is an "id" sequence from 1:1000 and the other is
variable with real values "VI" from -15.0 to 20.0 and I want to detect id
values that have indicator values less than a certain threshold, for
example (x=1) BUT that are in sequence equal or longer than 5.
For instance, in the following column I want to recognize the sequence from
"id" 4
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
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
2006 Jun 07
1
Fw: Help needed using lattice for area plots lpolygon, xyplot.
I am trying to learn how to use the graphics from the lattice package (
and am very new to R).
I am trying to replicate the example plot referenced below, by using the
lattice xyplot & lpolygon to create panels. I get what appears to be the
correct shape of the filled region, but cannot get the position to overlay
properly. I have attempted with various settings of position. ( i.e.
2007 Dec 04
3
Inserting a subsequence between values of a vector
Hallo,
suppose I have a vector:
x <- c(1,1,1,2,2,3,3,3,3,3,4)
How can I generate a vector/sequence in which a fixed number of zeroes (say
3) is inserted between the consecutive values, so I get
1,1,1,0,0,0,2,2,0,0,0,3,3,3,3,3,0,0,0,4
thanks a lot,
Serguei
[[alternative HTML version deleted]]
2012 Mar 06
4
Add number series to data frame
Hi,
Is there a simple way of doing the following in R?
a <- data.frame(name = c(rep("A", 3), rep("B", 5), rep("C", 10)))
> a
name
1 A
2 A
3 A
4 B
5 B
6 B
7 B
8 B
9 C
10 C
11 C
12 C
13 C
14 C
15 C
16 C
17 C
18 C
Do some fancy R code here:
> a
name val
1 A 1
2 A 2
3 A 3
4
2005 Feb 09
4
subset
Dear all,
I am trying to extract rows from a data.frame based on the
rowSums != 0. I want to preserve rownames in the first column in the subset.
Does anyone know how to extract all species that don't have rowSums equal
to zero? Here it is:
# dataset
x <- data.frame(
species=c("sp.1","sp.2","sp.3","sp.4"),
site1=c(2,3,0,0),
site2=c(0,0,0,0),
2016 Apr 22
2
subset by multiple letters condition
Hi all,
I have a data frame df and I want to do subset based on several conditions of letters of the names in Command.1)if the names contain PD 2)if the names contain t1 3)if the names contain t2 4)if the names contain t1 and PD 5)if the names contain t2 and PD 6)otherwise the names would be unknown. I don't know how to use grep for all these conditions.
'data.frame': 36919