Are #python users more likely to get into Slytherin?

This post requires some familiarity with the Harry Potter books but I’m committed to making this blog friendly to everyone, even Muggles/Nomajes. Have you seen Mark Sellors’ blog post series about writing command line utilities in R? It’s a great one but I was a bit puzzled by his using randomness to assign houses in his sorting hat example (he added a new method based on name digest-ing in the meantime). This is a really cool #rstats tutorial… but since when does the sorting hat assign a random Hogwarts house?! 🧙♀️🎩🎲➡️🏠🤔 https://t.co/Ff8CHR6jb9 — Maëlle Salmon 🐟 (@ma_salmon) 19 de desembre de 2017 This prompted a reply by David Hood who later came up with R code to assign you to a Hogwarts house based on your Twitter activity! It should be possible to assign House on the basis of Twitter…
Original Post: Are #python users more likely to get into Slytherin?

How to Use googlesheets to Connect R to Google Sheets

Often I use R to handle large datasets, analyze the data and filter out the data I don’t need. When all this is done, I usually use write.csv() to print my data off and reopen it in Google Sheets. My workflow would look something like this: full_data <- read.csv(“some_dataset.csv”) #R analysis ending up with relevant_data write.csv(relevant_data, “relevant_data.csv”) #continue work in Google Sheets However, there’s an R package that provides a bridge between your Google account and your R environment: googlesheets. Using this package we can read data directly from Google, modify it and create new files within our Google Drive. Step 1: Install googlesheets install.packages(googlesheets) library(googlesheets) Step 2: Authenticate your Google account Before we can do anything we need to allow google sheets to access our account.We can do this by running this: gs_auth(new_user = TRUE) Have a browser open…
Original Post: How to Use googlesheets to Connect R to Google Sheets

R⁶ — Capture Tweets with tweet_shot()

(You can find all R⁶ posts here) A Twitter discussion: I’m going to keep my eyes out for this one! Would love to have an easy way to embed tweets in Rmd talks! — Jeff Hollister (@jhollist) December 30, 2017 that spawned from Maëlle’s recent look-back post turned into a quick function for capturing an image of a Tweet/thread using webshot, rtweet, magick and glue. Pass in a status id or a twitter URL and the function will grab an image of the mobile version of the tweet. The ultimate goal is to make a function that builds a tweet using only R and magick. This will have to do until the new year. tweet_shot <- function(statusid_or_url, zoom=3) { require(glue, quietly=TRUE) require(rtweet, quietly=TRUE) require(magick, quietly=TRUE) require(webshot, quietly=TRUE) x <- statusid_or_url[1] is_url <- grepl(“^http[s]://”, x) if (is_url) { is_twitter <- grepl(“twitter”,…
Original Post: R⁶ — Capture Tweets with tweet_shot()

Five tips to improve your R code

(This article was first published on blogR, and kindly contributed to R-bloggers) @drsimonj here with five simple tricks I find myself sharing all the time with fellow R users to improve their code! This post was originally published on DataCamp’s community as one of their top 10 articles in 2017  1. More fun to sequence from 1 Next time you use the colon operator to create a sequence from 1 like 1:n, try seq(). # Sequence a vector x <- runif(10) seq(x) #> [1] 1 2 3 4 5 6 7 8 9 10 # Sequence an integer seq(nrow(mtcars)) #> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #> [24] 24 25 26 27 28 29 30 31 32 The colon operator can produce…
Original Post: Five tips to improve your R code

Looking back in 2017 and plans for 2018

– As we come close to the end of 2017, its time to look back. This hasbeen a great year for me in many ways. This blog started as a way towrite short pieces about using R for finance and promote mybook in an organic way.Today, I’m very happy with my decision. Discovering and trying newwriting styles keeps my interest very alive. Academic research is verystrict on what you can write and publish. It is satisfying to see that Ican promote my work and have an impact in different ways, not onlythrough the publication of academic papers. My blog is build using a Jekylltemplate, meaning the wholesite, including individual posts, is built and controlled with editabletext files and Github. All files related to posts follow the samestructure, meaning I can easily gather the textual data and organize itin a nice…
Original Post: Looking back in 2017 and plans for 2018

2017. Quantified. In. R.

2017 is nearly at an end. We humans seem to need these cycles to help us on our path forward and have, throughout history, used these annual demarcation points as a time of reflection of what was, what is an what shall come next. To that end, I decided it was about time to help quantify a part of the soon-to-be previous annum in R through the fabrication of a reusable template. Said template contains various incantations that will enable the wielder to enumerate their social contributions on: StackOveflow GitHub Twitter WordPress through the use of a parameterized R markdown document. The result of one such execution can be found here (for those who want a glimpse of what I was publicly up to in 2017). Want to see where you contributed the most on SO? There’s a vis for…
Original Post: 2017. Quantified. In. R.

Time To Shine

Blogging and social media for introverts – How to spot an introvert You may have seen David Robinson’s recent post encouraging R users to start blogging. Some folk will willingly act on this advice, and others won’t. For those that won’t, I know who you are.You.Yes, you, trying to hide at the back.I can spot an introvert. It’s easy. Simply say “we’re all going to take part in a team bonding exercise” and watch to see whose eyes point to the floor while everyone else leaps to their feet.How about “icebreakers”? “Turn to the person next to you and introduce yourself, and tell them what you hope to get out of the day”. There then follows 2 excruciating minutes while your enthusiastic neighbour gushes about what a great day they’re planning to have, while your internal monologue is trying to…
Original Post: Time To Shine

My #Best9of2017 tweets

You’ve probably seen people posting their #Best9of2017, primarily on Instagram I’d say. I’m not an Instagram user, although I do have an account to spy on my younger sister and cousins, so I don’t even have 9 Instagram posts in total but I do love the collage people get to show off… So what about my best 9 tweets of 2017? I first wanted to use rtweet::get_timeline but it only returned me tweets from July, even when using include_rts = FALSE, so I downloaded my analytics files from the Twitter website, one per trimester. my_files <- c(“tweet_activity_metrics_ma_salmon_20170101_20170402_en.csv”, “tweet_activity_metrics_ma_salmon_20170402_20170702_en.csv”, “tweet_activity_metrics_ma_salmon_20170702_20171001_en.csv”, “tweet_activity_metrics_ma_salmon_20171001_20171231_en.csv”) paths <- paste0(“data/”, my_files) # read them all at once my_tweets <- purrr::map_df(paths, readr::read_csv) # just in case I got some data ranges wrong my_tweets <- unique(my_tweets) # get the top 9! my_tweets <- dplyr::arrange(my_tweets, – likes) my_tweets <- janitor::clean_names(my_tweets)…
Original Post: My #Best9of2017 tweets

The first step to becoming a top performing data scientist

photo by https://unsplash.com/@joshuaearle Nearly every day, I see a new article talking about the benefits of data: “data will change the world” … “data is transforming business” … “data is the new oil.” Setting aside the hyperbolic language, most of this is true. So when you hear that “data scientist is the sexiest job of the 21st century,” you should mostly believe it. Companies are fighting to hire great data scientists. But there’s a catch. Even though there’s a huge demand for data scientists, a lot of people who study data science still can’t get jobs. I regularly hear from young data science students who tell me that they can’t get a job. Or they can get a “job,” but it’s actually an unpaid internship. What’s going on here? The dirty little secret is that companies are desperate for highly…
Original Post: The first step to becoming a top performing data scientist

New Year Goals

Here are some goals related to scientific research and clinical medicine that I’d like to see accomplished in 2018.Physicians come to know that precision/personalized medicine for the most part is based on a false premise Machine learning/deep learning is understood to not find previously unknown information in data in the majority of cases, and tends to work better than traditional statistical models only when dominant non-additive effects are present and the signal:noise ratio is decently high Practitioners will make more progress in correctly using “old” statistical tools such as regression models Medical diagnosis is finally understood as a task in probabilistic thinking, and sensitivity and specificity (which are characteristics not only of tests but also of patients) are seldom used Practitioners using cutpoints/thresholds for inherently continuous measurements will finally go back to primary references and find that the thresholds were…
Original Post: New Year Goals