« first day (1759 days earlier)      last day (1545 days later) » 

7:23 AM
morning all
 
7:42 AM
Hi @Sotos hi everyone :-)
 
Hello @Cath
Happy Friday :D
 
7:59 AM
@Sotos thanks. Also, I'm on vacations next week :-D
 
@Cath ohh nice. Doing anything special?
 
aloha
 
8:22 AM
@Sotos get some rest... ;-p
 
8:38 AM
@Cath So yes, very special! :P
 
@Sotos though I'll be with the kids so not sure I will reach my goal :-/
:'D
 
9:02 AM
FYI information: charcoal/sobotic/socvr and (some at this time) SO mods are planning a strike on 24th of february. If I get it right it means Queen/Natty will be "off" during this time.
@camille flag the post for moderator attention about him if he's rude/agressive
 
 
2 hours later…
10:40 AM
@MrFlick agree with the wish, but this would make this site even more "unwelcome" [eye-rolls].
Hello
Happy V day
 
@zx8754 ah yeah, happy V day to all :-)
 
V day?
 
@Jaap valentines :)
 
celebration of love ^^
 
10:56 AM
< facepalm >
 
exactly! hahahaha
 
[Jaap left the room... on his way to gift shop]
 
still here :P
@zx8754 it is much better to give a gift / flowers when she doesn't expect it ;-)
 
Completely agree, just went with most commonly expected V day move, of course every relation has its ways.
I replanted wife's almost dead plant from a small pot to a bigger one, she noticed it in the morning, it was cool :D
 
@zx8754 that's a good gift (and probably unexpected)
@zx8754 I completely agree
 
 
4 hours later…
3:08 PM
This post doesn't deserve downvotes, yes the Q was unclear, but OP was responsive. And post is like 10 mins old. stackoverflow.com/q/60228251/680068
^ they have 10M rows, not sure sapply is the right solution there, any data.table magic? @Jaap?
 
3:28 PM
Hum.. even base R could do something great there
Or more a roll join
 
4:13 PM
@zx8754 Doesn't sounds really nice to me but z[z,length(unique(z$id[z$id >= id & z$id <= id+5])),by=.EACHI] with z being z <- data.table(id=c(1,5,5,10,11,12),key="id")
not really quick on 1M row
 
4:25 PM
Less weird, reapply your approach: z[z,sum(unique(z$id[.I[1]:nrow(z)]) <= id+5),by=.EACHI]
 
4:37 PM
an approach with foverlaps (a bit cumbersome imo):
DT1 <- data.table(x1 = c(1,5,5,10,11,12))
DT2 <- DT1[, .(x1, x2 = x1 + 5)][, r := .I]
DT1[, `:=` (x2 = x1)]
setkey(DT2, x1, x2)
unique(foverlaps(DT1, DT2)[, .(r, i.x1)])[, .N, by = r][, .(N)]
 

« first day (1759 days earlier)      last day (1545 days later) »