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.

library(data.table)
mydt <- fread("daily_cycling_trips_by_usertype.csv")



READ SOURCE

READ  If at first you don't succeed, you may well be Cisco: WebEx patch needs its own patch

LEAVE A REPLY

Please enter your comment!
Please enter your name here