From 762a45afb09100cfb6dfc63560090bb47ccf6380 Mon Sep 17 00:00:00 2001 From: catalamarti Date: Wed, 22 Nov 2023 19:10:40 +0000 Subject: [PATCH] add readme --- .Rbuildignore | 1 + .Rhistory | 41 +++++++++++++++++++++++++++++++++ .gitignore | 3 +++ README.Rmd | 54 +++++++++++++++++++++++++++++++++++++++++++ README.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 163 insertions(+) create mode 100644 README.Rmd create mode 100644 README.md diff --git a/.Rbuildignore b/.Rbuildignore index 14958096..5500f01f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -2,3 +2,4 @@ ^\.Rproj\.user$ ^extras$ ^LICENSE\.md$ +^README\.Rmd$ diff --git a/.Rhistory b/.Rhistory index e69de29b..08afce68 100644 --- a/.Rhistory +++ b/.Rhistory @@ -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) diff --git a/.gitignore b/.gitignore index 508df787..565f2b6a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .Rproj.user .Rhistory +.Rdata +.httr-oauth +.DS_Store diff --git a/README.Rmd b/README.Rmd new file mode 100644 index 00000000..06a8209d --- /dev/null +++ b/README.Rmd @@ -0,0 +1,54 @@ +--- +output: github_document +--- + + + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + fig.path = "man/figures/README-", + out.width = "100%" +) +``` + +# CohortConstructor + + +[![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) + + +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) +``` + diff --git a/README.md b/README.md new file mode 100644 index 00000000..42c98981 --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ + + + +# CohortConstructor + + + +[![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) + + +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 [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 +#> +#> 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 +#> +#> 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) +```