How to use .SD in the R data.table package

For some data.table users, “dot-SD” is a bit of a mystery. But data.table creator Matt Dowle told me that it’s actually quite simple: Just think of it as a symbol representing “each group.” Let’s go through a couple of examples.

I have a data set of daily cycling trips from the Boston area’s bicycle-share system. If you’d like to follow along, you can download the CSV file from the link at the bottom of this article.

I’ll load data.table and import my CSV file using data.table’s fread() function. In the code below, I’m saving the data into a data table called mydt.

mydt <- fread("daily_cycling_trips_by_usertype.csv")


READ  Qualcomm’s new Bluetooth 5.1 and Wi-Fi 6 networking chip beams audio to multiple devices, reduces latency


Please enter your comment!
Please enter your name here