summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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