Cheatsheet.pdf

data table cheat sheet.pdf
Preview of cheatsheet
🔗 Source: s3.amazonaws.com
📊 Size: 562 KB
👤 Author: Klaas Nelissen
⬇️ Downloads: 144

Summary

The DataCamp course "Data Analysis the data.table Way" provides an overview of the data.table package in R. The general form of a data.table operation is DT[i, j, by], which means "take DT, subset rows using i, then calculate j grouped by by".

Key concepts include:

Creating a data.table: `DT <- data.table(V1=c(1L,2L), V2=LETTERS[1:3], V3=round(rnorm(4),4), V4=1:12)`
Subsetting rows: `DT[3:5,]` or `DT[V2 == "A"]`
Selecting columns: `DT[, V2]` or `DT[, .(V2, V3)]`
Calling functions: `DT[, sum(V1)]` or `DT[, .(sum(V1), sd(V3))]`
Grouping: `DT[, .(V4.Sum = sum(V4)), by=V1]` or `DT[, .(V4.Sum = sum(V4)), by=.(V1, V2)]`
Assigning new column names: `DT[, .(Aggregate = sum(V1), Sd.V3 = sd(V3))]`
Using .N to get the total number of observations: `DT[,.N,by=V1]`
Adding/updating columns by reference: `DT[, V1 := round(exp(V1),2)]` or `DT[, c("V1","V2") := list(round(exp(V1),2), LETTERS[4:6])]`
Removing columns: `DT[, V1 := NULL]` or `DT[, c("V1","V2") := NULL]`
Indexing and keys: `setkey(DT, V2)` and `DT["A"]` or `DT[c("A","C")]`
Using mult and nomatch arguments: `DT["A", mult ="first"]` or `DT[c("A","D"), nomatch = 0]`
Using by=.EACHI: `DT[c("A","C"), sum(V4), by=.EACHI]`

Description

The DataCamp course "Data Analysis the data.table Way" provides an overview of the data.table package in R.

Technical Information

  • File Format: PDF
  • File Size: 562 KB
  • Pages: 1
  • Language: EN
  • Author: Klaas Nelissen
  • Total Downloads: 144
  • Last Updated: 9 hours ago

Document Overview

This PDF document about cheatsheet provides comprehensive information and guidance. Whether you're a beginner or advanced user, this resource offers valuable insights into cheatsheet.

Related Topics

If you're interested in cheatsheet, you might also want to explore:

Download cheatsheet eBooks for free and learn more about cheatsheet. These books contain exercises and tutorials to improve your practical skills, at all levels!

Not satisfied with this document? We have related documents to cheatsheet, try searching with similar keywords: Active Directory Cheatsheet, algebra cheatsheet, Algebra Cheatsheet Year 9, basic algebra cheatsheet, Bootstrap Cheatsheet, Ccna Cheatsheet Free , cea cheatsheet, cheatsheet

You can download PDF versions of the user's guide, manuals and ebooks about cheatsheet, you can also find and download for free A free online manual (notices) with beginner and intermediate, Downloads Documentation, You can download PDF files (or DOC and PPT) about cheatsheet for free, but please respect copyrighted ebooks.