Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
catalamarti committed Nov 22, 2023
1 parent 15f1308 commit 762a45a
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 0 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
^\.Rproj\.user$
^extras$
^LICENSE\.md$
^README\.Rmd$
41 changes: 41 additions & 0 deletions .Rhistory
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
x <- c(1, 2, 3, 4, 5)
expand.grid(c)
expand.grid(x)
expand.grid(rep(list(x), length(x)))
5*5*5*5*5
lapply(names, c(0, 1))
lapply(names, function(x){c(0, 1)})
names
names <- c("cohort1", "cohort2", "cohort3", "cohort3")
names <- c("cohort1", "cohort2", "cohort3", "cohort4")
lapply(names, function(x){c(0, 1)})
lapply(names, function(x){c(0, 1)}) |>
expand.grid()
lapply(names, function(x){c(0, 1)}) |>
expand.grid() |>
rlang::set_names(name)
lapply(names, function(x){c(0, 1)}) |>
expand.grid() |>
rlang::set_names(names)
lapply(names, function(x){c(0, 1)}) |>
expand.grid() |>
rlang::set_names(names) |>
dplyr::as_tibble()
lapply(names, function(x){c(0, 1)}) |>
expand.grid() |>
rlang::set_names(names) |>
dplyr::as_tibble() %>%
dplyr::mutate("cohort_definition_id" = dplyr::row_number())
lapply(names, function(x){c(0, 1)}) |>
expand.grid() |>
rlang::set_names(names) |>
dplyr::as_tibble() |>
dplyr::mutate("cohort_definition_id" = dplyr::row_number())
getCohortSetMutuallyEclusive <- function(names) {
lapply(names, function(x){c(0, 1)}) |>
expand.grid() |>
rlang::set_names(names) |>
dplyr::as_tibble() |>
dplyr::mutate("cohort_definition_id" = dplyr::row_number())
}
getCohortSetMutuallyEclusive(names)
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.Rproj.user
.Rhistory
.Rdata
.httr-oauth
.DS_Store
54 changes: 54 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# CohortConstructor

<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/CohortConstructor)](https://CRAN.R-project.org/package=CohortConstructor)
[![codecov.io](https://codecov.io/github/oxford-pharmacoepi/CohortConstructor/coverage.svg?branch=main)](https://app.codecov.io/github/oxford-pharmacoepi/CohortConstructor?branch=main)
[![R-CMD-check](https://github.com/oxford-pharmacoepi/CohortConstructor/workflows/R-CMD-check/badge.svg)](https://github.com/oxford-pharmacoepi/CohortConstructor/actions)
[![Lifecycle:Experimental](https://img.shields.io/badge/Lifecycle-Experimental-339999)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->

The goal of CohortConstructor is to help on the creation of cohorts in the OMOP Common Data Model.

## Installation

You can install the development version of CohortConstructor from [GitHub](https://github.com/) with:

``` {r, eval = FALSE}
# install.packages("devtools")
devtools::install_github("oxford-pharmacoepi/CohortConstructor")
```

## Example

Generate a combination cohort.

```{r}
library(PatientProfiles)
library(CohortConstructor)
library(CDMConnector)
cdm <- mockPatientProfiles()
cdm <- generateCombinationCohortSet(cdm = cdm, name = "cohort3", targetCohortName = "cohort2")
cdm$cohort3
cohortSet(cdm$cohort3)
cdmDisconnect(cdm)
```

64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# CohortConstructor

<!-- badges: start -->

[![CRAN
status](https://www.r-pkg.org/badges/version/CohortConstructor)](https://CRAN.R-project.org/package=CohortConstructor)
[![codecov.io](https://codecov.io/github/oxford-pharmacoepi/CohortConstructor/coverage.svg?branch=main)](https://app.codecov.io/github/oxford-pharmacoepi/CohortConstructor?branch=main)
[![R-CMD-check](https://github.com/oxford-pharmacoepi/CohortConstructor/workflows/R-CMD-check/badge.svg)](https://github.com/oxford-pharmacoepi/CohortConstructor/actions)
[![Lifecycle:Experimental](https://img.shields.io/badge/Lifecycle-Experimental-339999)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->

The goal of CohortConstructor is to help on the creation of cohorts in
the OMOP Common Data Model.

## Installation

You can install the development version of CohortConstructor from
[GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("oxford-pharmacoepi/CohortConstructor")
```

## Example

Generate a combination cohort.

``` r
library(PatientProfiles)
#> Warning: package 'PatientProfiles' was built under R version 4.2.3
library(CohortConstructor)
library(CDMConnector)

cdm <- mockPatientProfiles()
cdm <- generateCombinationCohortSet(cdm = cdm, name = "cohort3", targetCohortName = "cohort2")

cdm$cohort3
#> # Source: table<cohort3> [4 x 4]
#> # Database: DuckDB 0.7.1 [martics@Windows 10 x64:R 4.2.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <dbl> <date> <date>
#> 1 2 1 2020-05-25 2020-05-25
#> 2 1 1 2019-12-30 2019-12-30
#> 3 1 1 2020-05-25 2020-05-25
#> 4 3 1 2020-05-25 2020-05-25

cohortSet(cdm$cohort3)
#> # A tibble: 7 × 6
#> cohort_definition_id cohort_name cohort_1 cohort_2 cohort_3 mutually_exclusive
#> <int> <chr> <dbl> <dbl> <dbl> <lgl>
#> 1 1 cohort_1 1 NA NA FALSE
#> 2 2 cohort_2 NA 1 NA FALSE
#> 3 3 cohort_1+c… 1 1 NA FALSE
#> 4 4 cohort_3 NA NA 1 FALSE
#> 5 5 cohort_1+c… 1 NA 1 FALSE
#> 6 6 cohort_2+c… NA 1 1 FALSE
#> 7 7 cohort_1+c… 1 1 1 FALSE

cdmDisconnect(cdm)
```

0 comments on commit 762a45a

Please sign in to comment.