From 846ddddd16f00471d31cd5d0414415efb4b203c6 Mon Sep 17 00:00:00 2001 From: Cory McCartan Date: Sat, 25 Mar 2023 20:13:59 -0400 Subject: [PATCH] pkgdown --- .gitignore | 6 ++++++ NEWS.md | 5 +++++ R/causal_idx.R | 2 ++ R/causal_tbl.R | 1 + _pkgdown.yml | 15 +++++++++++++++ man/causal_idx.Rd | 11 ++++++----- man/causal_tbl.Rd | 8 ++++---- man/causaltbl-package.Rd | 3 +++ 8 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 NEWS.md diff --git a/.gitignore b/.gitignore index 9168bf8..89219f8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,10 @@ .Rdata .httr-oauth .DS_Store + docs +pkgdown + +*.tmp +*.bak +*.swp diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..129d268 --- /dev/null +++ b/NEWS.md @@ -0,0 +1,5 @@ +# causaltbl 0.1.0 + +* Initial package release +* `causal_tbl` class which tracks causal-inference-related columns +* `causal_idx` type which can keep track of relationships between rows diff --git a/R/causal_idx.R b/R/causal_idx.R index 71f78b0..e951470 100644 --- a/R/causal_idx.R +++ b/R/causal_idx.R @@ -30,6 +30,8 @@ new_causal_idx <- function(x = list()) { #' print(idx) #' idx[1:2] # subsetting #' idx[c(2, 1, 3)] # reordering +#' +#' @order 1 #' @export causal_idx <- function(x = list()) { # convert each element to an integer diff --git a/R/causal_tbl.R b/R/causal_tbl.R index 8184aa3..4a72464 100644 --- a/R/causal_tbl.R +++ b/R/causal_tbl.R @@ -125,6 +125,7 @@ reconstruct.causal_tbl <- function(data, old) { #' is_causal_tbl(data) #' print(data) #' +#' @order 1 #' @export causal_tbl <- function(..., .outcome=NULL, .treatment=NULL) { data = vctrs::df_list(...) diff --git a/_pkgdown.yml b/_pkgdown.yml index ab5769a..5852c7c 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,19 @@ url: http://corymccartan.com/causaltbl/ template: bootstrap: 5 +reference: +- title: Causal data frames + contents: + - causal_tbl + - set_treatment + - set_outcome + - set_panel +- title: Special types + desc: '`vctrs`-friendly types that are useful for causal inference' + contents: + - causal_idx +- title: 'Extend `causal_tbl`' + desc: Developer-facing functions + contents: + - causal_cols diff --git a/man/causal_idx.Rd b/man/causal_idx.Rd index e02f2d3..8cd059f 100644 --- a/man/causal_idx.Rd +++ b/man/causal_idx.Rd @@ -1,16 +1,16 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/indices.R -\name{new_causal_idx} -\alias{new_causal_idx} +% Please edit documentation in R/causal_idx.R +\name{causal_idx} \alias{causal_idx} +\alias{new_causal_idx} \alias{is_causal_idx} \alias{as_causal_idx} \title{Construct a list of indices of type \code{causal_idx}} \usage{ -new_causal_idx(x = list()) - causal_idx(x = list()) +new_causal_idx(x = list()) + is_causal_idx(x) as_causal_idx(x) @@ -48,4 +48,5 @@ idx <- causal_idx(list(2, c(1, NA, 3), 2)) print(idx) idx[1:2] # subsetting idx[c(2, 1, 3)] # reordering + } diff --git a/man/causal_tbl.Rd b/man/causal_tbl.Rd index 4bcbb5c..84cbb5f 100644 --- a/man/causal_tbl.Rd +++ b/man/causal_tbl.Rd @@ -1,16 +1,16 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/causal_tbl.R -\name{new_causal_tbl} -\alias{new_causal_tbl} +\name{causal_tbl} \alias{causal_tbl} +\alias{new_causal_tbl} \alias{as_causal_tbl} \alias{is_causal_tbl} \title{Build a causal data frame} \usage{ -new_causal_tbl(..., .outcome = NULL, .treatment = NULL) - causal_tbl(..., .outcome = NULL, .treatment = NULL) +new_causal_tbl(..., .outcome = NULL, .treatment = NULL) + as_causal_tbl(x) is_causal_tbl(x) diff --git a/man/causaltbl-package.Rd b/man/causaltbl-package.Rd index 5b6519d..53a212d 100644 --- a/man/causaltbl-package.Rd +++ b/man/causaltbl-package.Rd @@ -6,12 +6,15 @@ \alias{causaltbl-package} \title{causaltbl: Tidy Causal Data Frames and Tools} \description{ +\if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} + Provides a 'causal_tbl' class for causal inference. A 'causal_tbl' keeps track of information on the roles of variables like treatment and outcome, and provides functionality to store models and their fitted values as columns in a data frame. } \seealso{ Useful links: \itemize{ \item \url{https://github.com/CoryMcCartan/causaltbl} + \item \url{http://corymccartan.com/causaltbl/} \item Report bugs at \url{https://github.com/CoryMcCartan/causaltbl/issues} }