My Authors
Read all threads
One more quick tweet, unrelated to the Gelman-Rubin diagnostic.

Someone asked, "I hear C++ is fast but a little hard to grasp. That true?"

Mostly yes. Like Python, R is mostly easier to learn and often is slower than C/C++.
I recommend you think about how your code will be used when you decide what language to code in. If you're coding for yourself and you probably just need to run it once, then R may be a good choice. Optimizing for speed may be overkill. (2/)
If you are writing a function/package for public consumption, then speed is much more of a concern. You can profile your code to see which parts are time-consuming. You can also just google what things R is slow at (ex loops). (3/)
For ex, in my R package glmm, I wrote my code initially in R because it's easy to write and debug. Then I rewrote the computationally expensive parts (ie pretty much everything once you pop the hood) in C. (4/)
I did this because glmm uses Monte Carlo (which is inherently computationally expensive). (5/)
I translated function-by-function into C, starting at the most basic building blocks. With each translation, I checked to make sure the calculations were identical between R and C. (6/)
In case you didn't know, you can call C from R. The way the R pkg glmm does this is with the .C function.

If you're into C++, you can check out the R package Rcpp, which helps you call C++ from R.

#Rstats (7/)
But remember there's a trade-off. R is generally faster/easier for a human to code in while C/C++/Fortran are faster for the computer to beep-boop through.

You don't get extra credit for coding everything in the fastest way possible. You can optimize your code... (8/)
Or you can optimize your LIFE by considering both the time coding/working and the time you spend socializing, exercising, relaxing, etc. (9/)
With that, I'm seriously out of here. Time to go live the other parts of my life. Take care and thanks for reading!

Cheers!

(10/10)
Missing some Tweet in this thread? You can try to force a refresh.

Keep Current with Women in Statistics and Data Science

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!