dth_key | R Documentation |
Setkey for multiple data.tables in one function
dth_key(...)
... |
# Make data.tables require(data.table) dt1 <- as.data.table(iris[,c(1,3,5)]) dt2 <- as.data.table(iris[,c(2,3,5)]) dt3 <- as.data.table(iris[,c(4,3,5)]) # they have not key set sapply(list(dt1,dt2,dt3), key) # First key set dth_key(dt1, dt2, dt3, Species) sapply(list(dt1,dt2,dt3), key) # Key can change dth_key(dt1, dt2, dt3, Petal.Length) sapply(list(dt1,dt2,dt3), key) # Key values can be a mix of quoted and non-quoted text dth_key(dt1, dt2, dt3, Petal.Length, 'Species') sapply(list(dt1,dt2,dt3), key) # order doesn't matter dt1 <- as.data.table(iris[,c(1,3,5)]) dt2 <- as.data.table(iris[,c(2,3,5)]) dt3 <- as.data.table(iris[,c(4,3,5)]) sapply(list(dt1,dt2,dt3), key) dth_key(dt1,Petal.Length, dt3,'Species',dt2 ) sapply(list(dt1,dt2,dt3), key)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.