Тёмный
No video :(

Write surprisingly fast for loops in R 

Josiah Parry
Подписаться 2,2 тыс.
Просмотров 1,3 тыс.
50% 1

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 7   
@gaborbakos9012
@gaborbakos9012 4 месяца назад
A very cool video! I find loops easier to understand and use than the apply functions. However I always had a bad feeling about using them as they are supposed to be inefficient. This video made me feel better about my terrible loopy loops :).
@spacelem
@spacelem 4 месяца назад
I do write plenty of for loops in R, but they're typically in places where either the speed really doesn't matter (e.g. `for (i in vars) ggplot(...)`) or where there's no way to vectorise the body (e.g. in stochastic simulations where there's a load of stuff going on and the loop depends on what happened in the previous loop, and I'm not that good at using `reduce()`). Typically I do what's easiest to read, and usually when something can be vectorised, it's easier to read that way anyway. If I need it to be fast, I have Julia, which says for loops are good actually since all the code is JITted, although Julia makes vectorising code trivial with its dot syntax (e.g. `log.(x)`).
@BarryRowlingsonBaz
@BarryRowlingsonBaz Год назад
At 06:01 you've got log(x)[i] in the loop which will compute all of log(x) and then take one value. Seems fixed in the benchmarks seconds later though.
@josiahparry
@josiahparry Год назад
oof! i thought i caught all of those. oops! should set eval = TRUE in the future to catch these 😅
@BarryRowlingsonBaz
@BarryRowlingsonBaz Год назад
@@josiahparry It would still work perfectly when evalled because log(x)[i] == log(x[i]) surely? :)
@jimmahgee
@jimmahgee Год назад
Turns out.... I'm bad 😅
@josiahparry
@josiahparry Год назад
That makes two of us! You’re in good company.
Далее
SLICED! Live Machine Learning
2:06:02
Просмотров 762
Write R functions like a pro in 6 minutes
6:46
Просмотров 1,2 тыс.
Как дела перцы?
00:25
Просмотров 52 тыс.
Throwing Swords From My Blue Cybertruck
00:32
Просмотров 10 млн
Why Inkscape writes everything twice
10:24
Просмотров 12 тыс.
Use less for-loops, use more vectorization
18:31
Просмотров 4,2 тыс.
How to get started with the bookdown package
18:43
Просмотров 7 тыс.
Loops using R programming
13:37
Просмотров 13 тыс.
S3 Objects and Functions in R
16:28
Просмотров 3,5 тыс.
Making R 300x times faster!
21:28
Просмотров 4,5 тыс.
Geohash: coding from scratch - Part 2
6:42
Просмотров 1,8 тыс.
Geohash: the algorithm inside and out - Part 1
15:37
From Zero to Async in Embedded Rust
1:02:06
Просмотров 13 тыс.
Как дела перцы?
00:25
Просмотров 52 тыс.