Skip to content

Commit

Permalink
readme updated
Browse files Browse the repository at this point in the history
  • Loading branch information
nkehrein committed Nov 22, 2024
1 parent 974aa4a commit 9059dd1
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 39 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cvasi Development version

# cvasi 1.3.1

* Improved `import_toxswa()`: now supports scaling of imported time series,
importing selected *TOXSWA* output variables, as well as importing selected
substance concentrations
Expand Down
1 change: 1 addition & 0 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#' @param x object to plot
#' @param y unused parameter
#' @param ... unused parameters
#' @return *ggplot2* plot object
NULL

# S3 overload to plot dose response curves
Expand Down
31 changes: 18 additions & 13 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "doc/figures/readme-",
fig.height=4,
fig.align='center',
out.width = "100%"
)
Expand All @@ -18,8 +20,8 @@ library(cvasi)
# cvasi: Calibration, Validation, and Simulation of TKTD models in R

<!-- badges: start -->
<!--[![CRAN status](https://www.r-pkg.org/badges/version/cvasi)](https://cran.r-project.org/package=cvasi)-->
<!--[![R-CMD-check](https://github.com/cvasi-tktd/cvasi/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/cvasi-tktd/cvasi/actions/workflows/R-CMD-check.yaml)-->
[![CRAN status](https://www.r-pkg.org/badges/version/cvasi)](https://cran.r-project.org/package=cvasi)
[![R-CMD-check](https://github.com/cvasi-tktd/cvasi/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/cvasi-tktd/cvasi/actions/workflows/R-CMD-check.yaml)
<!--[![Codecov test coverage](https://codecov.io/gh/xy/cvasi/branch/main/graph/badge.svg)](https://app.codecov.io/gh/xy/cvasi?branch=main)-->
<!-- badges: end -->

Expand All @@ -38,7 +40,7 @@ The package provides facilities to
* import fitted parameters from *morse*
* and more

A graphical user interface implemented in [Shiny](https://www.rstudio.com/products/shiny/)
A graphical user interface implemented in [Shiny](https://posit.co/products/open-source/rstudio/)
is also available, see the *[cvasi.ui](https://github.com/cvasi-tktd/cvasi.ui/)*
package. Please have a look at the [Changelog](NEWS.md)
for an overview of user-facing updates and changes.
Expand Down Expand Up @@ -68,8 +70,8 @@ on your machine. *Rtools* are required to compile the package's C code.

The package contains the following vignettes

* [User Manual](doc/cvasi-1-manual.md)
* [Modeling Howto](doc/cvasi-2-howto.md)
* [User Manual](https://github.com/cvasi-tktd/cvasi/blob/main/doc/cvasi-1-manual.md)
* [Modeling Howto](https://github.com/cvasi-tktd/cvasi/blob/main/doc/cvasi-2-howto.md)

They can also be accessed locally by executing an *R* statement such as:
```{r, eval=FALSE}
Expand All @@ -80,23 +82,26 @@ vignette("cvasi-1-manual", package="cvasi")
## Usage

Basic usage:
```{r,message=FALSE}
```{r,message=FALSE,out.width="70%"}
library(cvasi)
# create and parameterize a GUTS-RED-IT scenario
GUTS_RED_IT() %>%
set_param(c(kd=0.0005, hb=0, alpha=0.4, beta=1.5)) %>%
set_exposure(data.frame(time=c(0, 100, 101, 200, 201, 400),
conc=c(0, 0, 0.1, 0.1, 0, 0))) -> scenario
conc=c(0, 0, 0.1, 0.1, 0, 0))) %>%
set_times(1:400) -> scenario
# simulate scenario
scenario %>%
simulate(times=1:400) %>%
tail()
results <- scenario %>% simulate()
tail(results)
# ... and plot simulation results
plot(results)
```

Calculation of effects:
```{r out.width="50%",warning=FALSE}
```{r out.width="60%",warning=FALSE}
# calculate effect level
scenario %>% effect()
Expand All @@ -105,8 +110,8 @@ scenario %>% dose_response() -> drc
head(drc)
# plot the dose-response curve
library(ggplot2)
ggplot(drc) + geom_point(aes(mf,effect)) + scale_x_log10()
plot(drc)
# derive EPx values
scenario %>% epx()
```
Expand Down
57 changes: 33 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
# cvasi: Calibration, Validation, and Simulation of TKTD models in R

<!-- badges: start -->
<!--[![CRAN status](https://www.r-pkg.org/badges/version/cvasi)](https://cran.r-project.org/package=cvasi)-->
<!--[![R-CMD-check](https://github.com/cvasi-tktd/cvasi/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/cvasi-tktd/cvasi/actions/workflows/R-CMD-check.yaml)-->

[![CRAN
status](https://www.r-pkg.org/badges/version/cvasi)](https://cran.r-project.org/package=cvasi)
[![R-CMD-check](https://github.com/cvasi-tktd/cvasi/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/cvasi-tktd/cvasi/actions/workflows/R-CMD-check.yaml)
<!--[![Codecov test coverage](https://codecov.io/gh/xy/cvasi/branch/main/graph/badge.svg)](https://app.codecov.io/gh/xy/cvasi?branch=main)-->
<!-- badges: end -->

Expand All @@ -26,10 +28,10 @@ The package provides facilities to
- and more

A graphical user interface implemented in
[Shiny](https://www.rstudio.com/products/shiny/) is also available, see
the *[cvasi.ui](https://github.com/cvasi-tktd/cvasi.ui/)* package.
Please have a look at the [Changelog](NEWS.md) for an overview of
user-facing updates and changes.
[Shiny](https://posit.co/products/open-source/rstudio/) is also
available, see the *[cvasi.ui](https://github.com/cvasi-tktd/cvasi.ui/)*
package. Please have a look at the [Changelog](NEWS.md) for an overview
of user-facing updates and changes.

## Installation

Expand All @@ -55,8 +57,10 @@ your machine. *Rtools* are required to compile the package’s C code.

The package contains the following vignettes

- [User Manual](doc/cvasi-1-manual.md)
- [Modeling Howto](doc/cvasi-2-howto.md)
- [User
Manual](https://github.com/cvasi-tktd/cvasi/blob/main/doc/cvasi-1-manual.md)
- [Modeling
Howto](https://github.com/cvasi-tktd/cvasi/blob/main/doc/cvasi-2-howto.md)

They can also be accessed locally by executing an *R* statement such as:

Expand All @@ -75,53 +79,58 @@ library(cvasi)
GUTS_RED_IT() %>%
set_param(c(kd=0.0005, hb=0, alpha=0.4, beta=1.5)) %>%
set_exposure(data.frame(time=c(0, 100, 101, 200, 201, 400),
conc=c(0, 0, 0.1, 0.1, 0, 0))) -> scenario
conc=c(0, 0, 0.1, 0.1, 0, 0))) %>%
set_times(1:400) -> scenario

# simulate scenario
scenario %>%
simulate(times=1:400) %>%
tail()
results <- scenario %>% simulate()
tail(results)
#> time D H S
#> 395 395 0.004429420 0 0.998655
#> 396 396 0.004427206 0 0.998655
#> 397 397 0.004424993 0 0.998655
#> 398 398 0.004422781 0 0.998655
#> 399 399 0.004420570 0 0.998655
#> 400 400 0.004418360 0 0.998655

# ... and plot simulation results
plot(results)
```

<img src="doc/figures/readme-unnamed-chunk-5-1.png" width="70%" style="display: block; margin: auto;" />

Calculation of effects:

``` r
# calculate effect level
scenario %>% effect()
#> # A tibble: 1 × 4
#> # A tibble: 1 x 4
#> scenario L L.dat.start L.dat.end
#> <list> <dbl> <dbl> <dbl>
#> 1 <GutsRdIt> 0.00135 0 400
#> 1 <GutsRdIt> 0.00135 1 400

# create a dose-response curve
scenario %>% dose_response() -> drc
head(drc)
#> endpoint mf effect
#> 1 L 3.812500 0.009920108
#> 2 L 4.799653 0.013948570
#> 3 L 6.042405 0.019601514
#> 4 L 7.606938 0.027459506
#> 5 L 9.576567 0.038355140
#> 6 L 12.056184 0.053336114
#> 1 L 3.812500 0.009915394
#> 2 L 4.799653 0.013954569
#> 3 L 6.042405 0.019597765
#> 4 L 7.606938 0.027459877
#> 5 L 9.576567 0.038357524
#> 6 L 12.056184 0.053336214

# plot the dose-response curve
library(ggplot2)
ggplot(drc) + geom_point(aes(mf,effect)) + scale_x_log10()
plot(drc)
```

<img src="doc/figures/readme-unnamed-chunk-6-1.png" width="50%" />
<img src="doc/figures/readme-unnamed-chunk-6-1.png" width="60%" style="display: block; margin: auto;" />

``` r

# derive EPx values
scenario %>% epx()
#> # A tibble: 1 × 3
#> # A tibble: 1 x 3
#> scenario L.EP10 L.EP50
#> <list> <dbl> <dbl>
#> 1 <GutsRdIt> 19.0 82.1
Expand Down
Binary file added doc/figures/readme-unnamed-chunk-5-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/figures/readme-unnamed-chunk-6-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions man/plot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/cvasi-1-manual.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "User Manual"
author: "N. Kehrein"
date: "24 Octobre, 2024"
date: "24 October, 2024"
output:
rmarkdown::html_vignette:
toc: true
Expand Down
2 changes: 1 addition & 1 deletion vignettes/cvasi-2-howto.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Modeling Howto"
author: "N. Kehrein and contributors"
date: "24 Octobre, 2024"
date: "24 October, 2024"
output:
rmarkdown::html_vignette:
toc: true
Expand Down

0 comments on commit 9059dd1

Please sign in to comment.