Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jalbert, Joe
JoeTools
Commits
650f36ba
Commit
650f36ba
authored
Feb 24, 2020
by
Jalbert, Joe
Browse files
Fixed Bugs:
wbsave(): Coerces input to dataframe report(): fixed reference to Measures
parent
78da98ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/JoeToolFunctions.R
View file @
650f36ba
...
...
@@ -37,6 +37,7 @@ wbsave=function(df,filename,sheetBy=NULL,keepNames=FALSE){
if
(
keepNames
==
FALSE
)
{
names
(
df
)
=
str_to_sentence
(
names
(
df
))}
if
(
!
is.null
(
sheetBy
))
{
sheetBy
=
str_to_sentence
(
sheetBy
)}
wb
=
createWorkbook
()
df
=
as.data.frame
(
df
)
TABLE_COLNAMES_STYLE
<-
CellStyle
(
wb
)
+
Font
(
wb
,
heightInPoints
=
11
,
color
=
"#44546A"
,
isBold
=
TRUE
)
+
Border
(
color
=
"#8EA9DB"
,
position
=
"BOTTOM"
,
pen
=
"BORDER_THICK"
)
sheetAll
=
createSheet
(
wb
,
sheetName
=
"All"
)
...
...
@@ -77,7 +78,7 @@ report=function(df, Measures, Factor, paired=c("Yes", "No", "Try")){
summarise_at
(
vars
(
Measures
),
mean
,
na.rm
=
T
)
%>%
mutate
(
Levels
=
ifelse
(
.data
[[
Factor
]]
==
1
,
"Treatment"
,
"No_Treatment"
))
%>%
select
(
-
.data
[[
Factor
]])
%>%
pivot_longer
(
cols
=
Outcom
es
,
names_to
=
"Measure"
)
%>%
pivot_longer
(
cols
=
Measur
es
,
names_to
=
"Measure"
)
%>%
pivot_wider
(
names_from
=
"Levels"
,
values_from
=
"value"
)
%>%
mutate
(
Diff
=
Treatment
-
No_Treatment
)
%>%
mutate
(
Measure
=
factor
(
.data
$
Measure
,
levels
=
Measures
))
%>%
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment