-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsave_descriptive_tools_output.R
More file actions
86 lines (76 loc) · 5.69 KB
/
save_descriptive_tools_output.R
File metadata and controls
86 lines (76 loc) · 5.69 KB
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
library(dplyr)
library(writexl)
library(flextable)
library(officer)
working_directory
## Saving descriptive tools output
writexl::write_xlsx(list(tools_all = df_tools_unique,
tools_depression = df_tools_all %>% dplyr::filter(topic == "depression"),
tools_anxiety = df_tools_all %>% dplyr::filter(topic == "anxiety"),
tools_psychosis = df_tools_all %>% dplyr::filter(topic == "psychosis"),
tools_all_country = df_tools_country_unique,
tools_depression_country = df_tools_country_all %>% dplyr::filter(topic == "depression"),
tools_anxiety_country = df_tools_country_all %>% dplyr::filter(topic == "anxiety"),
tools_psychosis_country = df_tools_country_all %>% dplyr::filter(topic == "psychosis")
),
path = base::file.path(output_Dir, "tools_final.xlsx" )
)
writexl::write_xlsx(list(tools_depression = df_tools_top_n_all %>% dplyr::filter(topic == "depression"),
tools_anxiety = df_tools_top_n_all %>% dplyr::filter(topic == "anxiety"),
tools_psychosis = df_tools_top_n_all %>% dplyr::filter(topic == "psychosis"),
tools_depression_country = df_tools_country_top_n_all %>% dplyr::filter(topic == "depression"),
tools_anxiety_country = df_tools_country_top_n_all %>% dplyr::filter(topic == "anxiety"),
tools_psychosis_country = df_tools_country_top_n_all %>% dplyr::filter(topic == "psychosis")
),
path = base::file.path(output_Dir, paste0("tools_top_", df_top_n$n ,"_final.xlsx") )
)
flextable::save_as_docx(values = table_5,
path = base::file.path(output_Dir, "descriptive_count_tools_stats.docx"),
align = "center", #left, center (default) or right.
pr_section = officer::prop_section(
page_size = officer::page_size(orient = "landscape"), #Use NULL (default value) for no content.
page_margins = officer::page_mar(), #Use NULL (default value) for no content.
type = "nextPage", # "continuous", "evenPage", "oddPage", "nextColumn", "nextPage"
section_columns = NULL, #Use NULL (default value) for no content.
header_default = NULL, #Use NULL (default value) for no content.
header_even = NULL, #Use NULL (default value) for no content.
header_first = NULL, #Use NULL (default value) for no content.
footer_default = NULL, #Use NULL (default value) for no content.
footer_even = NULL, #Use NULL (default value) for no content.
footer_first = NULL #Use NULL (default value) for no content.
)
)
flextable::save_as_docx(values = table_6,
path = base::file.path(output_Dir, "descriptive_proportion_tools_stats.docx"),
align = "center", #left, center (default) or right.
pr_section = officer::prop_section(
page_size = officer::page_size(orient = "landscape"), #Use NULL (default value) for no content.
page_margins = officer::page_mar(), #Use NULL (default value) for no content.
type = "nextPage", # "continuous", "evenPage", "oddPage", "nextColumn", "nextPage"
section_columns = NULL, #Use NULL (default value) for no content.
header_default = NULL, #Use NULL (default value) for no content.
header_even = NULL, #Use NULL (default value) for no content.
header_first = NULL, #Use NULL (default value) for no content.
footer_default = NULL, #Use NULL (default value) for no content.
footer_even = NULL, #Use NULL (default value) for no content.
footer_first = NULL #Use NULL (default value) for no content.
)
)
flextable::save_as_docx(values = table_7,
path = base::file.path(output_Dir,
paste0("descriptive_proportion_top_", df_top_n$n ,"_tools_stats.docx")
),
align = "center", #left, center (default) or right.
pr_section = officer::prop_section(
page_size = officer::page_size(orient = "landscape"), #Use NULL (default value) for no content.
page_margins = officer::page_mar(), #Use NULL (default value) for no content.
type = "nextPage", # "continuous", "evenPage", "oddPage", "nextColumn", "nextPage"
section_columns = NULL, #Use NULL (default value) for no content.
header_default = NULL, #Use NULL (default value) for no content.
header_even = NULL, #Use NULL (default value) for no content.
header_first = NULL, #Use NULL (default value) for no content.
footer_default = NULL, #Use NULL (default value) for no content.
footer_even = NULL, #Use NULL (default value) for no content.
footer_first = NULL #Use NULL (default value) for no content.
)
)