Solving The Riddler using R

preview_player
Показать описание
In this week's #TidyTuesday video, I go over The Riddler's weekly puzzle using R. I show how the difference between using base R and Tidyverse and compare the pros and cons between the two methods.

#Tidyverse #TheRiddler

Рекомендации по теме
Комментарии
Автор

Update: The answer to the problem was 11/30 or 36.66%. My answer was slightly wrong because I took the compliment of the original solution but the process/approach was correct.

AndrewCouch
Автор

Andrew, if you are interested in making your R code significantly faster you may want to work with the data.table package. I’m sure you have heard of it. You could make a video comparing (compare the runtimes of filtering, grouping etc) and integrating the tidy approach and data.table

About the video:
1) you can use sample.int() instead of sample(). it is marginally faster
2) if you want to do a lot of simulations you may want to use pbreplicate() function from the pbapply package to track your progress.
3) it is a good habit to write large numbers with the e notation like this: replicate(1e6, fun()) instead of fun())

MrDanek
join shbcf.ru