Skip to content

Commit 63ed9c2

Browse files
fix of tfmn fn
1 parent 70e67c6 commit 63ed9c2

13 files changed

Lines changed: 21 additions & 15 deletions

R/fn_transform.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ transform_resc_occupcy_tb <- function (resc_occupcy_tb, resources_tb)
123123
#' @return Input data (a list)
124124
#' @rdname transform_to_clone_nat_dmd
125125
#' @export
126-
#' @importFrom purrr map2_dfr map_dfr
126+
#' @importFrom purrr map2_dfr map_chr map_dfr
127127
#' @importFrom dplyr filter mutate bind_rows select distinct
128128
#' @importFrom ready4fun get_from_lup_obj
129129
#' @keywords internal
@@ -140,10 +140,11 @@ transform_to_clone_nat_dmd <- function (input_data_ls, clone_ls = list(AUS_SNR_F
140140
~{
141141
template_1L_chr <- .y
142142
template_tb <- alt_inp_data_ls$resource_use_tb %>%
143-
dplyr::filter(Recipient_UID_chr == .y) %>% dplyr::mutate(Discipline_UID_chr = ready4fun::get_from_lup_obj(alt_inp_data_ls$resources_tb,
144-
match_var_nm_1L_chr = "Resource_UID_chr", match_value_xx = Resource_UID_chr,
145-
target_var_nm_1L_chr = "Discipline_UID_chr",
146-
evaluate_lgl = F))
143+
dplyr::filter(Recipient_UID_chr == .y) %>% dplyr::mutate(Discipline_UID_chr = Resource_UID_chr %>%
144+
purrr::map_chr(~ready4fun::get_from_lup_obj(alt_inp_data_ls$resources_tb,
145+
match_var_nm_1L_chr = "Resource_UID_chr", match_value_xx = .x,
146+
target_var_nm_1L_chr = "Discipline_UID_chr",
147+
evaluate_lgl = F)))
147148
recipients_chr <- .x
148149
new_tb <- purrr::map_dfr(recipients_chr, ~{
149150
state_1L_chr <- ready4fun::get_from_lup_obj(alt_inp_data_ls$recipients_tb,
@@ -155,7 +156,7 @@ transform_to_clone_nat_dmd <- function (input_data_ls, clone_ls = list(AUS_SNR_F
155156
match_var_nm_1L_chr = "Location_UID_chr",
156157
match_value_xx = state_1L_chr, target_var_nm_1L_chr = "STE_chr",
157158
evaluate_lgl = F) %>% ready4fun::get_from_lup_obj(data_lookup_tb = alt_inp_data_ls$resources_tb %>%
158-
dplyr::filter(Discipline_UID_chr == template_tb$Discipline_UID_chr,
159+
dplyr::filter(Discipline_UID_chr %in% unique(template_tb$Discipline_UID_chr),
159160
Recipient_Sex_chr == ready4fun::get_from_lup_obj(alt_inp_data_ls$recipients_tb,
160161
match_var_nm_1L_chr = "Recipient_UID_chr",
161162
match_value_xx = template_1L_chr, target_var_nm_1L_chr = "Sex_chr",

_pkgdown.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
home:
22
links:
3+
- text: Manual - User (PDF)
4+
href: https://dataverse.harvard.edu/api/access/datafile/5197656
5+
- text: Manual - Developer (PDF)
6+
href: https://dataverse.harvard.edu/api/access/datafile/5197655
37
- text: Project website
48
href: https://ready4-dev.github.io/ready4/
59
development:

data-raw/fns/transform.R

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ transform_to_clone_nat_dmd <- function(input_data_ls,
7777
template_1L_chr <- .y
7878
template_tb <- alt_inp_data_ls$resource_use_tb %>%
7979
dplyr::filter(Recipient_UID_chr == .y) %>%
80-
dplyr::mutate(Discipline_UID_chr = ready4fun::get_from_lup_obj(alt_inp_data_ls$resources_tb,
80+
dplyr::mutate(Discipline_UID_chr = Resource_UID_chr %>% purrr::map_chr(~ready4fun::get_from_lup_obj(alt_inp_data_ls$resources_tb,
8181
match_var_nm_1L_chr = "Resource_UID_chr",
82-
match_value_xx = Resource_UID_chr,
82+
match_value_xx = .x,
8383
target_var_nm_1L_chr = "Discipline_UID_chr",
84-
evaluate_lgl = F))
84+
evaluate_lgl = F)))
8585
recipients_chr <- .x
8686
new_tb <- purrr::map_dfr(recipients_chr,
8787
~ {
@@ -97,12 +97,13 @@ transform_to_clone_nat_dmd <- function(input_data_ls,
9797
match_value_xx = state_1L_chr,
9898
target_var_nm_1L_chr = "STE_chr",
9999
evaluate_lgl = F) %>%
100-
ready4fun::get_from_lup_obj(data_lookup_tb = alt_inp_data_ls$resources_tb %>% dplyr::filter(Discipline_UID_chr == template_tb$Discipline_UID_chr,
101-
Recipient_Sex_chr == ready4fun::get_from_lup_obj(alt_inp_data_ls$recipients_tb,
102-
match_var_nm_1L_chr = "Recipient_UID_chr",
103-
match_value_xx = template_1L_chr,
104-
target_var_nm_1L_chr = "Sex_chr",
105-
evaluate_lgl = F)),
100+
ready4fun::get_from_lup_obj(data_lookup_tb = alt_inp_data_ls$resources_tb %>%
101+
dplyr::filter(Discipline_UID_chr %in% unique(template_tb$Discipline_UID_chr),
102+
Recipient_Sex_chr == ready4fun::get_from_lup_obj(alt_inp_data_ls$recipients_tb,
103+
match_var_nm_1L_chr = "Recipient_UID_chr",
104+
match_value_xx = template_1L_chr,
105+
target_var_nm_1L_chr = "Sex_chr",
106+
evaluate_lgl = F)),
106107
match_var_nm_1L_chr = "Recipient_STE_chr",
107108
match_value_xx = .,
108109
target_var_nm_1L_chr = "Resource_UID_chr",

man/figures/fav120.png

-1.42 KB
Loading
-1.42 KB
Loading
-2.02 KB
Loading
-2.11 KB
Loading
-530 Bytes
Loading
-834 Bytes
Loading
-2.11 KB
Loading

0 commit comments

Comments
 (0)