{"id":13401143,"url":"https://github.com/DeclareDesign/randomizr","last_synced_at":"2025-03-14T06:32:15.826Z","repository":{"id":21817851,"uuid":"25140667","full_name":"DeclareDesign/randomizr","owner":"DeclareDesign","description":"randomizr: Easy-to-Use Tools for Common Forms of Random Assignment and Sampling","archived":false,"fork":false,"pushed_at":"2024-01-05T20:25:18.000Z","size":1649,"stargazers_count":36,"open_issues_count":2,"forks_count":9,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-09-20T05:13:32.908Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://declaredesign.org/r/randomizr","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DeclareDesign.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-10-13T02:59:02.000Z","updated_at":"2023-05-13T13:19:15.000Z","dependencies_parsed_at":"2023-02-11T23:31:32.897Z","dependency_job_id":"6a026bd8-e57d-4254-909b-f8ed1a651c97","html_url":"https://github.com/DeclareDesign/randomizr","commit_stats":{"total_commits":303,"total_committers":9,"mean_commits":"33.666666666666664","dds":0.6468646864686469,"last_synced_commit":"ffba72cdfba6e7b39d352625d8da56370ee57857"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeclareDesign%2Frandomizr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeclareDesign%2Frandomizr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeclareDesign%2Frandomizr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeclareDesign%2Frandomizr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeclareDesign","download_url":"https://codeload.github.com/DeclareDesign/randomizr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243538060,"owners_count":20307100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:00:59.171Z","updated_at":"2025-03-14T06:32:15.802Z","avatar_url":"https://github.com/DeclareDesign.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\ntitle: \"randomizr: Tools for random assignment and random sampling\"\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nset.seed(42)\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  message = FALSE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"  \n)\noptions(digits = 2)\n```\n\n[![CRAN status](https://www.r-pkg.org/badges/version/randomizr)](https://cran.r-project.org/package=randomizr)\n[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/grand-total/randomizr?color=green)](https://r-pkg.org/pkg/randomizr)\n[![Build status](https://github.com/DeclareDesign/randomizr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/DeclareDesign/randomizr/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/DeclareDesign/randomizr/graph/badge.svg)](https://app.codecov.io/gh/DeclareDesign/randomizr)\n[![Replications](https://softwarecite.com/badge/randomizr)](https://softwarecite.com/package/randomizr)\n\n**randomizr** is designed to make conducting field, lab, survey, or online experiments easier by automating the random assignment process. Social and lab scientists conducting experiments need a process to assign individuals or units of observation to treatment or control wings. Common designs include simple random assignment, complete randomization, block randomization, cluster randomization, and blocked cluster randomization. **randomizr** automates all of these processes and assists scientists in doing transparent, replicable science. We offer **randomizr** for both [`R`](https://declaredesign.org/r/randomizr) and [`Stata`](https://declaredesign.org/stata/randomizr).\n\n### Installing randomizr for R\n\nInstalling the latest stable version of **randomizr** in `R`:.\n\n```{r,eval=FALSE}\ninstall.packages(\"randomizr\")\n```\n\n### Getting started with randomizr for R\n\n**randomizr** has five main random assignment functions, corresponding to the common experimental designs listed above. You can read more about using each of these functions in our [reference library](https://declaredesign.org/r/randomizr/reference/) or by clicking on the function names: `simple_ra()`, `complete_ra()`, `block_ra()`, `cluster_ra()`, and `block_and_cluster_ra()`.\n\n`complete_ra()` (Complete randomization) is the function that will be most appropriate for a large number of experimental situations: when you want to assign a fixed `m` units out of a population of `N` units to treatment:\n\n```{r echo=TRUE, results=\"hide\"}\nlibrary(randomizr)\nZ \u003c- complete_ra(N = 100, m = 50)\ntable(Z)\n```\n```{r echo=FALSE}\nknitr::kable(t(as.matrix(table(Z))))\n```\n\nA more complicated design that, for example, assigns different numbers of clusters to three different treatments, makes use of `cluster_ra()` (Cluster randomization):\n\n```{r echo=TRUE, results=\"hide\"}\n# This makes a cluster variable: one unit in cluster \"a\", two in \"b\"...\nclust_var \u003c- rep(letters[1:15], times = 1:15)\n\nZ \u003c- cluster_ra(\n  clusters = clust_var,\n  m_each = c(4, 4, 7),\n  conditions = c(\"control\", \"placebo\", \"treatment\")\n  )\ntable(Z, clust_var)\n```\n```{r echo=FALSE}\nknitr::kable(table(Z, clust_var))\n```\n\nFor more information about all of **randomizr**'s functionality, please see our [online tutorial](https://declaredesign.org/r/randomizr/articles/randomizr_vignette.html)\n\n### randomizr for Stata\n\nInstalling the latest stable version of **randomizr** from ssc is easy:\n\n```{r eval=FALSE}\nssc install randomizr\n```\n\nIf you would like to install the latest development release directly from GitHub, run the following code:\n\n```{r eval=FALSE}\nnet install randomizr, from(https://raw.githubusercontent.com/DeclareDesign/strandomizr/master/) replace\n```\n\nHappy randomizing!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDeclareDesign%2Frandomizr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDeclareDesign%2Frandomizr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDeclareDesign%2Frandomizr/lists"}