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
0a35afc0
Commit
0a35afc0
authored
Jan 11, 2021
by
Jalbert, Joe
Browse files
Fixed Binomial evaluation bug with tryCatch
parent
b6dd1652
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/JoeToolFunctions.R
View file @
0a35afc0
...
...
@@ -282,7 +282,8 @@ pairwise <- function(df, Ind, Dep, Factor, Logit=FALSE){
pvalue
=
test
%>%
mutate
(
data
=
map2
(
Dep_Values_No_Treatment
,
Dep_Values_Treatment
,
~
bind_rows
(
tibble
(
Independant
=
rep
(
1
,
length
(
.y
)),
Dependant
=
.y
),
tibble
(
Independant
=
rep
(
0
,
length
(
.x
)),
Dependant
=
.x
))))
%>%
mutate
(
p_value
=
map
(
data
,
~
summary
(
glm
(
Dependant
~
Independant
,
family
=
"binomial"
,
data
=
.x
))
$
coefficients
[
2
,
4
]))
%>%
mutate
(
p_value
=
tryCatch
({
map
(
data
,
~
summary
(
glm
(
Dependant
~
Independant
,
family
=
"binomial"
,
data
=
.x
))
$
coefficients
[
2
,
4
])},
error
=
function
(
e
)
{
NA
}))
%>%
select
(
-
data
)
%>%
mutate
(
p_value
=
as.numeric
(
unlist
(
p_value
)))
}
else
{
...
...
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