You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A data.table is an enhanced version of the data.frame class from base R. As such, its class() attribute is the vector "data.table" "data.frame" and functions that work on a data.frame will also work with a data.table. There are many ways to create, load or coerce to a data.table, as seen here.
modify data.frame by reference
rbindlist a bunch of sub-tables built with data.table()
coerce a data.frame
copy()
fread()
Adding and modifying columns
... hm, this is getting somewhat tedious. i will dump the contents into a new file, exercises.something
Re sets (under "getting work done"), anyDuplicated ("Read the docs, use it with big table x, note the speedup vs any(duplicated(x))")
Similarly, re missing values (under "basics"), anyNA
In Basics > Vectors, the gl() function for making fancy sequences (I'm also thinking about use of grouping() which seems to supply data.table internals...)
shifting a single column by group where fill= is a constant can be addressed by sorting on grouping vars and using ungrouped shift. Also applies to x - shift(x, fill=first(x)) or x > shift(x, fill=first(x)), since those are 0 & FALSE by construction shift() in data.table v1.9.6 is slow for many groups Rdatatable/data.table#1534 (just saved myself from a long computation by searching the issues for this...)
(looking at those i contributed to Docs.SO...)
Cleaning data
DT = data.table(id = c(1,2,2,3,3,3))[, v := LETTERS[.I]][]
... going beyond Docs.SO:
Creating a data.table
A data.table is an enhanced version of the data.frame class from base R. As such, its
class()
attribute is the vector"data.table" "data.frame"
and functions that work on a data.frame will also work with a data.table. There are many ways to create, load or coerce to a data.table, as seen here.Adding and modifying columns
... hm, this is getting somewhat tedious. i will dump the contents into a new file,
exercises.something
Another: https://stackoverflow.com/q/49282735/
The text was updated successfully, but these errors were encountered: