Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jalbert, Joe
JoeTools
Commits
4a57ab38
Commit
4a57ab38
authored
Jul 14, 2020
by
Jalbert, Joe
Browse files
Fixed appendInteraction bugs
Fixed wbsave default (keepNames=T now)
parent
0b23e958
Changes
2
Hide whitespace changes
Inline
Side-by-side
R/JoeToolFunctions.R
View file @
4a57ab38
...
...
@@ -23,12 +23,12 @@ se=function(data){
#'
#' @examples
simplifyAppend
<-
function
(
input
)
{
x
=
match
(
"Signif"
,
colnames
(
input
))
+1
y
=
as.numeric
(
ncol
(
input
))
#
x=match("Signif",colnames(input))+1
#
y=as.numeric(ncol(input))
df
=
input
%>%
filter
(
!
is.nan
(
Diff
))
%>%
mutate
(
across
(
x
:
y
,
~
cut
(
.
,
breaks
=
c
(
0
,
.001
,
.01
,
.05
,
.1
,
.999
,
1
),
labels
=
c
(
"***"
,
"**"
,
"*"
,
"."
,
"NS"
,
"1"
))))
%>%
select
(
1
:
x
-1
,
where
(
~
sum
((
.
%in%
c
(
"***"
,
"**"
,
"*"
,
"."
)))
>
0
))
mutate
(
across
(
one_of
(
colnames
(
input
)[
match
(
"Signif"
,
colnames
(
input
))
+1
])
&
where
(
is.numeric
)
,
~
cut
(
.
,
breaks
=
c
(
0
,
.001
,
.01
,
.05
,
.1
,
.999
,
1
),
labels
=
c
(
"***"
,
"**"
,
"*"
,
"."
,
"NS"
,
"1"
))))
%>%
select
(
1
:
Signif
,
where
(
~
sum
((
.
%in%
c
(
"***"
,
"**"
,
"*"
,
"."
)))
>
0
))
}
#' Flexible Workbook Creation Function
...
...
@@ -51,7 +51,7 @@ simplifyAppend <- function(input) {
#' data(iris)
#' wbsave(iris, "Iris report.xlsx")
#' wbsave(iris, "Iris report - by Species.xlsx", sheetBy="Species", keepNames=TRUE)
wbsave
=
function
(
df
,
filename
,
sheetBy
=
NULL
,
keepNames
=
FALS
E
){
wbsave
=
function
(
df
,
filename
,
sheetBy
=
NULL
,
keepNames
=
TRU
E
){
if
(
keepNames
==
FALSE
)
{
names
(
df
)
=
str_to_sentence
(
names
(
df
))}
if
(
!
is.null
(
sheetBy
))
{
sheetBy
=
str_to_sentence
(
sheetBy
)}
wb
=
createWorkbook
()
...
...
@@ -157,7 +157,7 @@ appendInteraction=function(report,df, Measures,Factor,Interaction, Simplify=T){
}
}
anova
=
bind_rows
(
anova
)
if
(
nrow
(
anova
)
>
0
){
if
(
nrow
(
anova
)
>
0
&
(
!
is.null
(
anova
))
){
output
=
report
%>%
left_join
(
anova
,
by
=
"Measure"
)
if
(
Simplify
==
T
){
...
...
man/wbsave.Rd
View file @
4a57ab38
...
...
@@ -4,7 +4,7 @@
\alias{wbsave}
\title{Flexible Workbook Creation Function}
\usage{
wbsave(df, filename, sheetBy = NULL, keepNames =
FALS
E)
wbsave(df, filename, sheetBy = NULL, keepNames =
TRU
E)
}
\arguments{
\item{df}{The dataframe to be saved}
...
...
Write
Preview
Markdown
is supported
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