[R] Method Guidance

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Wed Jan 12 07:44:51 CET 2022


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          1         0        0
5          0         1        1
6          0         0        0
7          0         1        3
8          1         1        0
9          0         0        0
10         0         1        2",
header=TRUE,stringsAsFactors=FALSE)
plot(jrdf$Time-0.2,jrdf$Event_A,type="p",
 xlim=c(1,12),ylim=c(0.9,1.1),
 xlab="Day",ylab="",main="The As and the Bs",
 pch=c(" ","A")[jrdf$Event_A+1],yaxt="n")
points(jrdf$Time+jrdf$Lag_B+0.2,jrdf$Event_B,pch=c(" ","B")[jrdf$Event_B+1])

Jim

On Wed, Jan 12, 2022 at 1:33 PM Jeff Newmiller <jdnewmil using dcn.davis.ca.us> wrote:
>
> 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/post/cumsum-and-diff-tricks/
>
> ps not sure what "grate so sour" was supposed to be.
>
> pps While loops are not necessarily evil.
>
> On January 11, 2022 4:56:20 PM PST, Jeff Reichman <reichmanj using sbcglobal.net> wrote:
> >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 A happens again
> >at time 4 and Event B happens the next day and 3 days later so on and so
> >forth. I gather there is no function that will do that so I suspect I will
> >need to grate so sour of do while loop?  Any suggestions?
> >
> >
> >
> >
> >
> >Time      Event_A               Event_B               Time_B
> >
> >1              1                              1
> >0
> >
> >2              0                              1
> >1
> >
> >3              0                              0
> >0
> >
> >4              1                              0
> >0
> >
> >5              0                              1
> >1
> >
> >6              0                              0
> >0
> >
> >7              0                              1
> >3
> >
> >8              1                              1
> >0
> >
> >9              0                              0
> >0
> >
> >10           0                              1                              2
> >
> >
> >
> >
> >Jeff Reichman
> >
> >
> >       [[alternative HTML version deleted]]
> >
> >______________________________________________
> >R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained, reproducible code.
>
> --
> Sent from my phone. Please excuse my brevity.
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list