Skip to content

Commit 7e042a8

Browse files
tweak examples
1 parent 46dbcdd commit 7e042a8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

man/mergelist.Rd

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ l = list(
109109
lapply(l[-1L], `[`, j = if (.N>1L) .SD, by = "id1") ## duplicated rows
110110
try(mergelist(l, on="id1"))
111111

112-
## 'star schema' and 'snowflake schema' examples
112+
## 'star schema' and 'snowflake schema' examples (realistic data sizes)
113113

114114
### populate fact: US population by state and date
115115

@@ -144,9 +144,10 @@ rm(gt, tt)
144144
### denormalize 'star schema'
145145

146146
l = list(fact, time, geog)
147-
ans = mergelist(l)
147+
str(l)
148+
mergelist(l)
148149

149-
rm(l, ans)
150+
rm(l)
150151

151152
### turn 'star schema' into 'snowflake schema'
152153

@@ -155,6 +156,7 @@ make.lvl = function(x, cols) {
155156
lvl = x[, unique(.SD), .SDcols=cols]
156157
setkeyv(lvl, cols[1L])
157158
setindexv(lvl, as.list(cols))
159+
lvl
158160
}
159161
time = list(
160162
date = make.lvl(
@@ -174,9 +176,10 @@ geog = list(
174176

175177
#### left join all
176178
l = c(list(fact=fact), time, geog)
177-
ans = mergelist(l)
179+
str(l)
180+
mergelist(l)
178181

179-
rm(ans)
182+
rm(l)
180183
#### merge hierarchies alone, reduce sizes in merges of geog dimension
181184
ans = mergelist(list(
182185
fact,

0 commit comments

Comments
 (0)