- Only accepted if R CMD CHECK passes with no WARNINGS or ERRORs
- Long-term archive, and difficult to remove
- Provides registry of R packages
- Zenodo DOIs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(class) | |
| library(mass) | |
| library(mva) | |
| tst <- read.table("e:/uni/stats766/puktest.txt", header = TRUE) | |
| tst.v <- tst[,1:7] | |
| tst.g <- tst[,8] | |
| trn <- read.table("e:/uni/stats766/puktrain.txt", header = TRUE) | |
| trn.v <- trn[,1:7] | |
| trn.g <- trn[,8] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| R_COMPLETION=FALSE | |
| R_LIBS=~/R | |
| TMPDIR=/tmp | |
| _R_CHECK_FORCE_SUGGESTS_=false | |
| GITHUB_PAT=[redacted] | |
| DO_PAT=[redacted] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library("shiny") | |
| x <- runApp(shinyApp( | |
| fluidPage( | |
| "Password:", | |
| tags$input(id = "password", type = "password"), | |
| actionButton("done", "Done") | |
| ), | |
| function(input, output) { | |
| observe({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(stringi) | |
| locales <- stri_locale_list() | |
| main <- locales[!stri_detect_fixed(locales, "_")] | |
| main_col <- lapply(main, stri_opts_collator) | |
| sorted <- lapply(main_col, function(x) stri_sort(letters, opts_collator = x)) | |
| names(sorted) <- main | |
| noquote(simplify2array(Filter(function(x) !identical(x, letters), sorted))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library("stringi") | |
| ref <- ISOdatetime(2006, 01, 02, 15, 4, 0, "MST") | |
| formats <- c("%H", "%Y", "%y", "%b", "%B", "%m", "%d", "%e", "%a", | |
| "%A", "%I", "%l", "%p", "%Z", "%z", "%M", "%S") | |
| # Must manually respecify TZ because strftime doesn't use the time zone | |
| # stored in ref | |
| conv <- vapply(formats, function(x) strftime(ref, x, tz = "MST"), character(1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| recode <- function(df, ..., match = c("first", "last")) { | |
| match <- match.arg(match) | |
| cases <- lapply(list(...), as.case) | |
| if (identical(match, "last")) cases <- rev(cases) | |
| n <- nrow(df) | |
| out <- rep(NA, length(n)) # logical will be upcast as needed | |
| # Simple loop-y implementation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| `[.my_df` <- function (x, i, j) { | |
| if (missing(i) && missing(j)) return(x) | |
| # First, subset columns | |
| if (!missing(j)) { | |
| x <- .subset(x, j) | |
| } | |
| # Next, subset rows | |
| if (!missing(i)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iclass <- function(x) { | |
| c( | |
| if (is.matrix(x)) "matrix", | |
| if (is.array(x) && !is.matrix(x)) "array", | |
| if (is.double(x)) "double", | |
| if (is.integer(x)) "integer", | |
| mode(x) | |
| ) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Rcpp.h> | |
| using namespace Rcpp; | |
| // [[Rcpp::export]] | |
| std::string escape_one(std::string x) { | |
| int n = x.size(); | |
| std::string out = "\""; | |
| out.reserve(n + 2); | |
| for (int i = 0; i < n; ++i) { |