Skip to content

Commit fb73bc5

Browse files
committed
Sort output by date; comment cleanup
1 parent e43fc13 commit fb73bc5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

facebook/contingency-combine.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env Rscript
22

3-
## Combine and compress contingency tables by aggregation.
3+
## Combine and compress contingency tables by grouping variable set.
44
##
55
## Usage:
66
##
@@ -45,13 +45,13 @@ run_rollup <- function(input_dir, output_dir, pattern = "^[0-9]{8}_[0-9]{8}.*[.]
4545
seen_files <- load_seen_file(seen_file)
4646

4747
for (output_name in names(files)) {
48-
browser
48+
4949
newly_seen_files <- combine_and_save_tables(
5050
seen_files,
5151
input_dir,
5252
files[[output_name]],
5353
file.path(output_dir, output_name))
54-
browser()
54+
5555
write(newly_seen_files, seen_file, append=TRUE)
5656
}
5757

@@ -138,8 +138,8 @@ combine_and_save_tables <- function(seen_files, input_dir, input_files, output_f
138138
write_csv(input_df, output_file, append=file.exists(output_file))
139139
} else {
140140
assert(file.exists(output_file),
141-
paste0("The output file ", output_file, " does not exist, but ",
142-
"non-zero files using the same grouping have been seen before."))
141+
paste0("The output file ", output_file, " does not exist, but non-zero",
142+
" files using the same grouping variables have been seen before."))
143143

144144
output_df <- read_csv(output_file, col_types = cols)
145145

@@ -158,7 +158,8 @@ combine_and_save_tables <- function(seen_files, input_dir, input_files, output_f
158158
arrange(issue_date) %>%
159159
group_by(across(all_of(group_names))) %>%
160160
slice_tail() %>%
161-
ungroup()
161+
ungroup() %>%
162+
arrange(period_start)
162163

163164
# Automatically uses gzip compression based on output file name.
164165
write_csv(output_df, output_file)

0 commit comments

Comments
 (0)