Dear Jeff,
I am sending an updated version of the code.
The initial version assumed that the time points correspond to an
integer sequence. The code would fail for arbitrary times.
The new code is robust. I still assume that the data is in column-format
and that you want the time to the p
Suppose your data were represented as parallel vectors "time" and "type",
meaning that at time[i] a type[i] event occurred. You didn't say what you
wanted if there were a run of "A" or "B". If you are looking for the time
span between the last of a run of one sort of event and the first of a run
Dear Jeff,
My answer is a little bit late, but I hope it helps.
jrdf = read.table(text="Time Event_AEvent_B Lag_B
1 1 10
2 0 11
3 0 00
4 1 00
5 0 11
6 0
, Jan 12, 2022 1:44 am
Subject: Re: [R] Method Guidance
Hi Jeff,
A completely obscure question deserves a completely obscure answer:
jrdf<-read.table(text="Time Event_A Event_B Lag_B
1 1 1 0
2 0 1 1
3 0 0 0
4
-project.org
Subject: Re: [R] Method Guidance
Hello,
Here is a base R solution for what I understand of the question.
It involves ave and cumsum. cumsum of the values of Event_A breaks Event_B in
segments and ave applies a function to each segment. To find where are the
times B, coerce to logical and
Hello,
Here is a base R solution for what I understand of the question.
It involves ave and cumsum. cumsum of the values of Event_A breaks
Event_B in segments and ave applies a function to each segment. To find
where are the times B, coerce to logical and have which() take care of
it. Data in
Hi Jeff,
A completely obscure question deserves a completely obscure answer:
jrdf<-read.table(text="Time Event_AEvent_B Lag_B
1 1 10
2 0 11
3 0 00
4 1 00
5 0 11
6
1) Figure out how to post plain text please. What you saw is not what we see.
2) I see a "table" of input information but no specific expectation of what
would come out of this hypothetical function.
3) Maybe you will find something relevant in this blog post:
https://jdnewmil.github.io/blog/po
R-Help Forum
Looking for a little guidance. Have an issue were I'm trying to determine
the time between when Event A happened(In days) to when a subsequent Event B
happens. For Example at Time 1 Evat A happens and subsequently Event B
happens at the same day (0) and the next day (1) then Event
9 matches
Mail list logo