A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/csids/plnr below:

csids/plnr: A framework for planning and executing analyses in R.

plnr

plnr is a powerful framework for planning and executing analyses in R. It's designed for scenarios where you need to:

To install the development version or access packages that haven't been released on CRAN:

  1. Edit your .Rprofile:
usethis::edit_r_profile()
  1. Add the following configuration:
options(
  repos = structure(c(
    CSVERSE = "https://www.csids.no/drat/",
    CRAN    = "https://cran.rstudio.com"
  ))
)
  1. Restart R and install:
  1. Read the introduction vignette
  2. Check out the adding analyses guide
  3. Run help(package="plnr") for detailed function documentation
library(plnr)
library(ggplot2)
library(data.table)

# Create a new plan
p <- Plan$new()

# Add data
p$add_data(
  name = "deaths",
  direct = data.table(deaths=1:4, year=2001:2004)
)

# Add analyses for different years
p$add_argset(name = "fig_1_2002", year_max = 2002)
p$add_argset(name = "fig_1_2003", year_max = 2003)

# Define analysis function
fn_fig_1 <- function(data, argset) {
  plot_data <- data$deaths[year <= argset$year_max]
  ggplot(plot_data, aes(x=year, y=deaths)) +
    geom_line() +
    geom_point(size=3) +
    labs(title = glue::glue("Deaths from 2001 until {argset$year_max}"))
}

# Apply function to all argsets
p$apply_action_fn_to_all_argsets(fn_name = "fn_fig_1")

# Run analyses
p$run_one("fig_1_2002")

Contributions are welcome! Please feel free to submit a Pull Request.

This package is licensed under the MIT License - see the LICENSE file for details.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4