News for hackers. Stuff that matters.
Re:Analyzing networks of characters in 'Love Actually' by minimaxir on Friday December 25, 2015 @06:53PM (#10792749)
A minor R tip: if you're trying to filter on substrings in dplyr, using grepl() is faster and does not require loading an extra package.

That said, this is a great, clear writeup, and I wasn't aware R had dendrogram capabilities natively. I'll have to spend more time looking into Igraph too.

Re:Analyzing networks of characters in 'Love Actually' by hadley on Friday December 25, 2015 @10:40PM (#10793169)
I find that surprising. Do you have benchmarks?
Re:Analyzing networks of characters in 'Love Actually' by minimaxir on Friday December 25, 2015 @11:10PM (#10793219)
Huh. Turns out I'm wrong. I ran benchmarking on a 1.8M row dataset of SF crime data w/ 100 replications.

Running grepl() via:

   benchmark(df %>% sample_frac() %>% filter(grepl("ARREST", Resolution)))
completed in 257.58 seconds.

Running str_detect() via:

   benchmark(df %>% sample_frac() %>% filter(str_detect(Resolution, "ARREST")))
completed in 248.917 seconds.

Overall, str_detect() is faster by 3%. The stringr packages has more surprises than I thought!