« first day (58 days earlier)      last day (3256 days later) » 

7:19 AM
Hello
@Frank thanks for your recomendations, I got my code 15 times faster :)
 
good morning
 
Hi !
 
 
1 hour later…
8:49 AM
morning
 
@DavidArenburg hello, Thanks for the links on profiling, it was very interesting :)
 
@Tensibai np
Frank is probebly the best R code optimizer on SO currently btw
Finally a voice of reason on SO
2
Excellent solution!! I am going to use this. Data.table is so convenient and easy to interpret. — Sharath 11 hours ago
 
@DavidArenburg ;)
 
@Tensibai its not under my solution or anything :) But good to hear some nice things about data.table syntax once in a while
2
 
So my highest upvoted answer is in R ... I can't believe it ...
 
9:39 AM
@DavidArenburg, I think I've fallen in love with data.table, since yesterday, I replaced like >50 lines of ugly "regular R/data.frames" code with just few lines of efficient data.table code :-)))))
2
I'll have to go over all my scripts to modify everything that can be but it's totally worth it
 
@CathG yes, that can be sometimes a problem
most of the things work with base R code on data.table objects
but sometimes the ,with = FALSE part screws it up
I had to do this once too, but now all my scripta are written with just data.table code
 
@DavidArenburg yes I could keep my "old" code but I'm basically trying to optimise it, so I definitely need data.table wonderfulness for that. It's for script that run online and so the less people wait for the result, the better
 
 
1 hour later…
10:50 AM
@DavidArenburg we are thinking about restoring data.frame behaviour for character and integer/numeric values in j.. :-) Will file an issue later today.
@CathG glad to hear that. One way to learn is also by answering here on SO. Feel free to post your answers, and I (and others here) would be happy to point you in the right direction, if necessary. Also feel free to point out the things that you find odd / bother you (that may very well a bug or design flaw that we've not thought about)!! :-)
 
11:21 AM
@Arun That's great news! It's one of these things that you tried to explain to me many times but I never understood. Like why something like that DT <- data.table(A = "a") ; DT[, 1:4] even works or why the output is meaningful/makes sense
 
11:50 AM
Bon matin :)
 
12:04 PM
Bonjour @StevenBeaupré
 
Un autre francophone ?
Pretty interesting answer using bitmask comparison BTW
 
@Arun thanks :-) I'm "hunting" for data.table questions but I think for now, there will be 4 or 5 answers before I find my way through it ;-)
Salut Steven :-)
 
12:21 PM
Thanks Steven ;)
 
12:39 PM
@Tensibai Nice!
@DavidArenburg Thanks :) i think i'm just the most frequent lately
 
1:03 PM
@DavidArenburg "day light saving times" is that what we call "summer time" ? ;-)
@zx8754 another one for your hobby :-)
 
@CathG yep
@CathG voted
 
@Tensibai and it's closed :-)
 
Yep, it was missing only one vote :)
 
you gave the OP the "coup de grâce"
 
Indeed
 
1:17 PM
another one (just one more vote needed ;-) )
 
I don't understand this question. Is it about looping over arguments before calling the R script ?
@CathG already voted on it
 
@Tensibai no idea what the OP means...
(I'm not sure the OP himself fully understand what he wants)
and as many, he seems to think there are only mind readers on SO that will know what "Tableau" is (when there is only one actually)
 
@CathG well the question is properly tagged with it, so I've a clue of what it is, so maybe I'm just ignorant, or maybe the question itself is bad and worth downvote. As Unsure I'll let it as is
 
@Tensibai Congrats! Speaking of which, I can't get your answer to run. I get a "Error: length(width)==1 is not TRUE" from tree_sample -> strtoi -> str_pad -> check_string. Do you mind clearing your workspace and trying to run your code again to see if maybe there is a loose variable I'm missing?
 
@BrodieG no problem
 
1:25 PM
@Tensibai, ah-ah, I don't even know it enough that I've thought it was a homemade function :-)))
didn't downvote but the question could do with a bit of formatting...
 
Also, fyi, typically stuff like x[a == b] is much faster as x[which(a==b)] (ridiculous, right)? and if you are searching for a character value multiple times in the same pool, you can use fastmatch::fmatch. I think our logic is actually very similar, except I'm using the integer representation of the bits as a proxy for the bitmask.
 
@BrodieG Yes, according to your description I'm more or less on the same idea, using the decimal values too once padded
 
@Tensibai And thanks for introducing me to bitWAnd and co.
 
You're welcome
Well, from a fresh session, sourcing the code works as expected without warning
 
@Tensibai Weird. Let me update my packages.
 
1:33 PM
R version 3.2.0
 
@Tensibai Ok, that was the issue. stringr out of date.
 
:o)
 
sorry for the trouble.
 
No problem
It's better with @Frank help, but it still does not scale to very large samples
 
 
1 hour later…
2:41 PM
@Tensibai seems to scale mostly linearly, so I think it is okay. You can probably optimize it a fair bit more without changing the core algorithm either. I ran out of time, so will post an update later.
 
@BrodieG No Problem, thanks for the work in summarizing all the approaches
 
how can you have R finding 0,272959 is numeric ? come from here
 
@CathG What do you mean ?
 
Isn't using , as a decimal fairly common in some places and just a locale setting?
 
@Tensibai I mean that R will find 0.272959 numeric but not with a comma instead of a point
@BrodieG I didn't know you could put that in R... "my R" is sometimes (on one of the computers I'm using...) talking to me in french but never considering , as a decimal separator ;-)
 
2:57 PM
@CathG see Sys.getlocale() changing LC_NUMERIC from C to French_France should allow this
Huhu:
> Sys.setlocale("LC_NUMERIC","French_France.1252")
[1] "French_France.1252"
Warning message:
In Sys.setlocale("LC_NUMERIC", "French_France.1252") :
changer 'LC_NUMERIC' peut résulter en un fonctionnement étrange de R
 
@Tensibai rofl
 
well then, if it's what the OP has, it's strange that melt is putting his comma-delimited number as character...
@Tensibai excellent !!! :-)
ok, gotta go get my kids. Have a nice sunny week-end (for Tensibai, I know it will be, for the others I hope it will ;-) ) ! :-)
 
@Cath nice WE too
 
Thanks :-)
@BrodieG so you sepak a little french ;-)
ok, really gotta go !!
 
@CathG enough that I'll know if you're talking badly about me ;)
 
3:05 PM
Best idea I have is options(OutDec)which change the decimal separator
> options(OutDec = ",")
> as.numeric("0,25")
[1] NA
Warning message:
NAs introduits lors de la conversion automatique
> as.numeric("0.25")
[1] 0,25
I can confirm the idea
 
 
3 hours later…
6:26 PM
looking at this question stackoverflow.com/questions/30943167/… , i was considering that hack i've seen people use to go from logical to 0/1. it turns out +0L is pretty terrible. maybe it caught on instead of as.integer because people hate typing? if so, may i suggest the unary + function. equally hacky, but faster:
x <- sample(c(TRUE,FALSE,NA),1e8,replace=TRUE)
system.time("+"(x))
#   user  system elapsed
#   0.08    0.03    0.11
system.time(x+0L)
#   user  system elapsed
#   0.49    0.01    0.50
system.time(as.integer(x))
#   user  system elapsed
#   0.06    0.05    0.11
system.time(as.numeric(x))
#   user  system elapsed
#   0.32    0.11    0.43
 
 
3 hours later…
9:47 PM
@Tensibai okay, posted now.
@Frank good to know.
 
10:18 PM
@Tensibai, @CathG: I tried to improve it a bit: stackoverflow.com/questions/30939051/…
 

« first day (58 days earlier)      last day (3256 days later) »