summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Orbekk <kjetil.orbekk@gmail.com>2017-10-28 09:01:12 -0400
committerKjetil Orbekk <kjetil.orbekk@gmail.com>2017-10-28 09:01:12 -0400
commitcaa8efb96982f7db378ba1e8ee467040fa25e896 (patch)
tree3d66c072b290615571d5f80502e39e649cf7d183
parent5ac895c31a1070d8b6ebef4e094d45bfe0cceaf7 (diff)
fix db stuff.
-rw-r--r--db.Rmd8
1 files changed, 4 insertions, 4 deletions
diff --git a/db.Rmd b/db.Rmd
index 5df6a06..2b84a3a 100644
--- a/db.Rmd
+++ b/db.Rmd
@@ -14,7 +14,6 @@ tasks <- data.table(
owner = c('Alice,Bob', 'Bob', 'Alice')
)
setkey(tasks, task_id)
-
kable(tasks)
```
@@ -24,8 +23,8 @@ of a task.
```{r result='asis'}
owners <- tasks[, .(owner=unlist(strsplit(owner, ','))), by=.(task_id)]
setkey(owners, task_id, owner)
-
kable(owners)
+kable(tasks[, owner := NULL])
```
# Second normal form
@@ -55,7 +54,8 @@ kable(task_dependencies[, dependent_target_date := NULL][])
We can still get the target dates by joining:
```{r result='asis'}
-kable(tasks[task_dependencies, on=.(task_id = depends_on)])
+kable(tasks[task_dependencies, on=.(task_id = depends_on),
+ .(task_id, depends_on, target_date)])
```
# Third normal form
@@ -76,5 +76,5 @@ not the primary key.
```{r result='asis'}
categories <- tasks[, .(category, location = category_location)]
kable(categories)
-kable(tasks[, `:=`(category = NULL)][])
+kable(tasks[, `:=`(category_location = NULL)][])
``` \ No newline at end of file