Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stressaddition
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
oekotox
stressaddition
Commits
c0f61eab
Commit
c0f61eab
authored
5 years ago
by
Sebastian Henz
Browse files
Options
Downloads
Patches
Plain Diff
Remove last remnants of hormesis_index argument,
closes
#14
parent
0f474df3
No related branches found
No related tags found
1 merge request
!3
V2.0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/ecxsys.R
+9
-8
9 additions, 8 deletions
R/ecxsys.R
tests/testthat/test-ecxsys.R
+8
-20
8 additions, 20 deletions
tests/testthat/test-ecxsys.R
with
17 additions
and
28 deletions
R/ecxsys.R
+
9
−
8
View file @
c0f61eab
...
...
@@ -81,15 +81,16 @@ ecxsys <- function(concentration,
if
(
length
(
concentration
)
>
length
(
unique
(
concentration
)))
{
stop
(
"Concentrations must be unique."
)
}
if
(
length
(
hormesis_concentration
)
!=
1
)
{
stop
(
"hormesis_concentration must be a single number."
)
}
if
(
!
hormesis_concentration
%in%
concentration
)
{
stop
(
"hormesis_concentration must equal one of the concentration values."
)
}
hormesis_index
=
which
(
hormesis_concentration
==
concentration
)
if
(
length
(
hormesis_index
)
!=
1
)
{
stop
(
"hormesis_index must be a single integer."
)
}
else
if
(
hormesis_index
<=
2
||
hormesis_index
>=
length
(
concentration
))
{
stop
(
"hormesis_index must be greater than 2 and less than "
,
"(length(concentration))."
)
if
(
hormesis_index
<=
2
||
hormesis_index
>=
length
(
concentration
))
{
stop
(
"hormesis_concentration must be greater than the lowest "
,
"non-control concentration and less than the highest concentration"
)
}
if
(
is.null
(
effect_tox_env_observed
))
{
with_env
<-
FALSE
...
...
@@ -122,11 +123,11 @@ ecxsys <- function(concentration,
}
if
(
any
(
concentration
<
0
))
{
stop
(
"Concentrations must be >= 0"
)
}
else
if
(
min
(
concentration
)
>
0
)
{
}
if
(
min
(
concentration
)
>
0
)
{
stop
(
"No control is given. The first concentration must be 0."
)
}
else
{
min_conc
<-
10
^
floor
(
log10
(
concentration
[
2
])
-
conc_shift
)
}
min_conc
<-
10
^
floor
(
log10
(
concentration
[
2
])
-
conc_shift
)
# scale observed effect -----------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
tests/testthat/test-ecxsys.R
+
8
−
20
View file @
c0f61eab
...
...
@@ -10,18 +10,6 @@ mod <- ecxsys(
)
test_that
(
"error when both hormesis arguments passed to ecxsys"
,
{
expect_error
(
ecxsys
(
effect_tox_observed
=
c
(
85
,
76
,
94
,
35
,
0
),
concentration
=
c
(
0
,
0.03
,
0.3
,
3
,
10
),
hormesis_index
=
3
,
hormesis_concentration
=
0.3
)
)
})
test_that
(
"error when hormesis_concentration not in concentration"
,
{
expect_error
(
ecxsys
(
...
...
@@ -36,30 +24,30 @@ test_that("error when hormesis_concentration not in concentration", {
test_that
(
"error when hormesis_index <= 2 or >= (length(concentration))"
,
{
expect_error
(
ecxsys
(
effect_tox_observed
=
c
(
85
,
76
,
94
,
35
,
0
),
concentration
=
c
(
0
,
0.03
,
0.3
,
3
,
10
),
hormesis_index
=
1
hormesis_concentration
=
0
,
effect_tox_observed
=
c
(
85
,
76
,
94
,
35
,
0
)
)
)
expect_error
(
ecxsys
(
effect_tox_observed
=
c
(
85
,
76
,
94
,
35
,
0
),
concentration
=
c
(
0
,
0.03
,
0.3
,
3
,
10
),
hormesis_index
=
2
hormesis_concentration
=
0.03
,
effect_tox_observed
=
c
(
85
,
76
,
94
,
35
,
0
)
)
)
expect_error
(
ecxsys
(
effect_tox_observed
=
c
(
85
,
76
,
94
,
35
,
0
),
concentration
=
c
(
0
,
0.03
,
0.3
,
3
,
10
),
hormesis_index
=
5
hormesis_concentration
=
10
,
effect_tox_observed
=
c
(
85
,
76
,
94
,
35
,
0
)
)
)
expect_error
(
ecxsys
(
effect_tox_observed
=
c
(
85
,
76
,
94
,
35
,
0
),
concentration
=
c
(
0
,
0.03
,
0.3
,
3
,
10
),
hormesis_index
=
6
hormesis_concentration
=
30
,
effect_tox_observed
=
c
(
85
,
76
,
94
,
35
,
0
)
)
)
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment