Re: [R] Inserting missing seq number

2022-03-30 Thread Jeff Reichman
Bill Thank you. This is a third option to look into. Jeff From: Bill Dunlap Sent: Wednesday, March 30, 2022 10:40 AM To: reichm...@sbcglobal.net Cc: R-help@r-project.org Subject: Re: [R] Inserting missing seq number stats::approx can do the job: > approx(x=df$seq, df$co

Re: [R] Inserting missing seq number

2022-03-30 Thread Bill Dunlap
stats::approx can do the job: > approx(x=df$seq, df$count, xout=1:7, method="constant", f=0) $x [1] 1 2 3 4 5 6 7 $y [1] 4 7 7 3 5 5 2 -Bill On Tue, Mar 29, 2022 at 7:47 PM Jeff Reichman wrote: > R-help > > Is there a R function that will insert missing sequence number(s) and then > fill a mi

Re: [R] Inserting missing seq number

2022-03-29 Thread Avi Gross via R-help
: R-help@r-project.org Sent: Tue, Mar 29, 2022 10:47 pm Subject: [R] Inserting missing seq number R-help Is there a R function that will insert missing sequence number(s) and then fill a missing observation with the preceding value. For example df <- data.frame(seq = c(1,2,4,5,7), count