-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwrapped_ops.R
101 lines (95 loc) · 3.71 KB
/
wrapped_ops.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#' @export
#' @keywords internal
#'
build_pivot_control.wrapped_relop <-
function(table,
columnToTakeKeysFrom,
columnToTakeValuesFrom,
...,
prefix = columnToTakeKeysFrom,
sep = NULL,
tmp_name_source = wrapr::mk_tmp_name_source("bpc"),
temporary = FALSE) {
wrapr::stop_if_dot_args(substitute(list(...)),
"cdata::build_pivot_control.wrapped_relop")
underlying = build_pivot_control(table,
columnToTakeKeysFrom,
columnToTakeValuesFrom,
prefix = prefix,
sep = sep,
tmp_name_source = tmp_name_source,
temporary = temporary)
res <- list(underlying = underlying,
data_map = source$data_map)
class(res) <- 'wrapped_relop'
return(res)
}
#' @export
#' @keywords internal
#'
blocks_to_rowrecs.wrapped_relop <-
function(tallTable,
keyColumns,
controlTable,
...,
columnsToCopy = NULL,
checkNames = TRUE,
checkKeys = FALSE,
strict = FALSE,
controlTableKeys = colnames(controlTable)[[1]],
tmp_name_source = wrapr::mk_tmp_name_source("bltrr"),
temporary = TRUE,
allow_rqdatatable = FALSE) {
wrapr::stop_if_dot_args(substitute(list(...)),
"cdata::blocks_to_rowrecs.wrapped_relop")
underlying = blocks_to_rowrecs(tallTable,
keyColumns,
controlTable,
columnsToCopy = columnsToCopy,
checkNames = checkNames,
checkKeys = checkKeys,
strict = strict,
controlTableKeys = controlTableKeys,
tmp_name_source = tmp_name_source,
temporary = temporary,
allow_rqdatatable = allow_rqdatatable)
res <- list(underlying = underlying,
data_map = source$data_map)
class(res) <- 'wrapped_relop'
return(res)
}
#' @export
#' @keywords internal
#'
unpivot_to_blocks.wrapped_relop <-
function(data,
nameForNewKeyColumn,
nameForNewValueColumn,
columnsToTakeFrom,
...,
checkNames = TRUE,
checkKeys = FALSE,
strict = FALSE,
nameForNewClassColumn = NULL,
tmp_name_source = wrapr::mk_tmp_name_source("upb"),
temporary = TRUE,
allow_rqdatatable = FALSE) {
wrapr::stop_if_dot_args(substitute(list(...)),
"cdata::unpivot_to_blocks.wrapped_relop")
underlying = unpivot_to_blocks(data,
nameForNewKeyColumn,
nameForNewValueColumn,
columnsToTakeFrom,
checkNames = checkNames,
checkKeys = checkKeys,
strict = strict,
nameForNewClassColumn = nameForNewClassColumn,
tmp_name_source = tmp_name_source,
temporary = temporary,
allow_rqdatatable = allow_rqdatatable)
res <- list(underlying = underlying,
data_map = source$data_map)
class(res) <- 'wrapped_relop'
return(res)
}
# TODO: documenting tests on above.