« first day (2849 days earlier)      last day (441 days later) » 

6:40 AM
Hello hello :)
 
 
1 hour later…
8:04 AM
Hello everyone
 
Hello
Did anyone else get the invite for community?
 
Goodmorning all
 
hello @ all
 
 
2 hours later…
10:56 AM
Hello
 
 
1 hour later…
12:04 PM
data.table masters: anyway I can avoid using cols in my answer? stackoverflow.com/a/75385539/680068
 
1:00 PM
@zx8754 lapply(.SD[c('Value1','Value2'), shift) ?
(missing the , and closing ] for .SD subselection)
 
 
2 hours later…
2:46 PM
@Tensibai Did you mean: data[,lapply(.SD[,c('Value1','Value2')], shift), by = Country ] ?
 
Yep
 
This doesn't give expected output, original values are missing
 
data[,c('value1_new','values2_new') := lapply(.SD[,c('Value1','Value2')], shift), by = Country ]
 
See dplyr answer, more automated column naming: mutate(across(contains("Value"), lag, .names = "{col}_lagged"), .by = Country)
 
I don't think it change much versus your .SDCol one however
Didn't checked much the question TBH :D
data[,v1_new:=shift(v1), by=country][,v2_new:=shift(v2), by=country]
If it needs looping over columns containing value in name and uncertain number of them, then I'd do it differently indeed
Your solution would be ok by making cols as a string match from dt.colnames.
 
2:54 PM
Yeah, I was thinking in case when we have 1000 columns :D
 
 
1 hour later…
4:16 PM
@zx8754 Looks good to me, why are trying to improve it? I remember Michael was pushing some regarding avoiding in the LH if it already in .SDcols but have no idea if it was ever imlemented
Found it, looks like still open: github.com/Rdatatable/data.table/issues/1543
 
 
2 hours later…
6:38 PM
@DavidArenburg OK, thought there was a dplyr like way without creating cols.
 
6:51 PM
2
Q: We’ve made changes to our Privacy Notice for Collectives™

Cesar MWe’ve just made a few adjustments to our Privacy Notice for Collectives™. They were made to make the notice ready for the upcoming expansion of Collectives into new areas of practice - as well as streamline and make some points clearer. There isn't a ton of impact to users here or significant dep...

 

« first day (2849 days earlier)      last day (441 days later) »