commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
5308a8aa38973009530b9073e13c1f9eca2ba449 | Add informative error when matrix size is diff | efcaguab/paco | R/prepare_data.r | R/prepare_data.r | #' Prepare the datapoll
#' Simple wrapper to make sure that the matrices are sorted accordingly
#' @param H Host distance matrix
#' @param P Parasite distance matrix
#' @param HP Host-parasite association matrix, hosts in rows
#' @return A list with objects H, P, HP
#' @export
#' @examples
#' data(gopherlice)
#' lib... | #' Prepare the datapoll
#' Simple wrapper to make sure that the matrices are sorted accordingly
#' @param H Host distance matrix
#' @param P Parasite distance matrix
#' @param HP Host-parasite association matrix, hosts in rows
#' @return A list with objects H, P, HP
#' @export
#' @examples
#' data(gopherlice)
#' lib... | mpl-2.0 | R |
1e3f6d0490e1b8ab37fdccd9604b12d6f9167c37 | Fix bug produced by renaming of slurm script | jmousseau/Stain | R/slurm-job.r | R/slurm-job.r | #' Submit one or more slurm jobs.
#'
#' This function will submit your slurm job given the path
#' to a slurm container.
#'
#' @param jobs The \code{job_<alphanumeric>/} directories for
#' the slurm container. May also
#'
#' @export
submit_jobs <- function(jobs) {
wd <- getwd()
for (dir in jobs) {
tryC... | #' Submit one or more slurm jobs.
#'
#' This function will submit your slurm job given the path
#' to a slurm container.
#'
#' @param jobs The \code{job_<alphanumeric>/} directories for
#' the slurm container. May also
#'
#' @export
submit_jobs <- function(jobs) {
wd <- getwd()
for (dir in jobs) {
tryC... | mit | R |
6584935f3fdbef34f90273396282afa3819e5409 | Fix import for explicitly run tests | klmr/modules,klmr/modules | inst/tests/run-all.r | inst/tests/run-all.r | library(testthat)
library(modules)
test_package('import')
| library(testthat)
library(import)
test_package('import')
| apache-2.0 | R |
a26a68f20e578b5dbcdc2d66042d5eff406779d3 | Fix error | owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus | r/time-by-cost-by-inst.r | r/time-by-cost-by-inst.r | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly=TRUE)
if (length(args)!=1) {
cat("time-by-cost-by-inst YYYY-MM\n")
return(NA)
}
period <- args
source("r/simpletemplate.r")
source("r/dbtools.r")
db <- "thomas"
dba <- "thomas_sgelogs"
# Get table of institutions.
query <- "select inst_id from thomas.inst... | #!/usr/bin/env Rscript
args <- commandArgs(trailingOnly=TRUE)
if (length(args)!=1) {
cat("jsperinst YYYY-MM\n")
return(NA)
}
period <- args
source("r/simpletemplate.r")
source("r/dbtools.r")
db <- "thomas"
dba <- "thomas_sgelogs"
# Get table of institutions.
query <- "select inst_id from thomas.institutes"
ins... | mit | R |
ceaff3f2e6803ffead8e1cc4c2579d123dba7b30 | Add scripts for Google Analytics. | snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3 | web/_foot.rd | web/_foot.rd | =begin html
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2913796-1";
urchinTracker();
</script>
=end
| =begin html
=end
| mit | R |
1a5428c995f221904b996201a9e2b50e27ead3be | Fix syntax errors in ms-drives.r | hostilefork/rebol,hostilefork/rebol,codebybrett/ren-c,giuliolunati/ren-c,draegtun/ren-c,kealist/ren-c,kealist/ren-c,rgchris/ren-c,codebybrett/ren-c,codebybrett/ren-c,hostilefork/rebol,draegtun/ren-c,kealist/ren-c,hostilefork/rebol,giuliolunati/ren-c,draegtun/ren-c,giuliolunati/ren-c,hostilefork/rebol,hostilefork/rebol,... | tests/atronix/ms-drives.r | tests/atronix/ms-drives.r | REBOL []
msvcrt: make library! %msvcrt.dll
getdrives: make-routine msvcrt "_getdrives" compose/deep [
return: [uint32]
]
maps: getdrives
i: 0
while [i < 26] [
unless zero? maps and* shift 1 i [
print unspaced [to char! (to integer! #"A") + i ":"]
]
++ i
]
close msvcrt
| REBOL []
msvcrt: make library! %msvcrt.dll
getdrives: make routine! compose/deep [
[return: [uint32]]
(msvcrt) "_getdrives"
]
maps: getdrives
i: 0
while [i < 26] [
unless zero? maps and* shift 1 i [
print rejoin [to char! (to integer! #"A") + i ":"]
]
++ i
]
close msvcrt
| apache-2.0 | R |
5164cd9ff967dbf04781c968b43266dc4cf9d50c | Clean up onAttach hook | syberia/syberia | R/zzz.r | R/zzz.r | .onAttach <- function(...) {
if (!isTRUE(getOption("syberia.silent"))) {
packageStartupMessage(paste0("Loading ", crayon::red("Syberia"), "...\n"))
}
# We want to initialize a Syberia project in the current working directory
# because 9 times out of 10 this is what the user wants.
#
# However, this h... | .onAttach <- function(...) {
if (!isTRUE(getOption("syberia.silent"))) {
packageStartupMessage(paste0("Loading ", crayon::red("Syberia"), "...\n"))
}
# We want to initialize a Syberia project in the current working directory
# because 9 times out of 10 this is what the user wants.
#
# However, this h... | mit | R |
8523bc2352a24956076fa84462ee2ef2a36c0347 | Update server.r | aleksandrov2/APPR-2015-16 | shiny/server.r | shiny/server.r | library(knitr)
library(ggplot2)
library(dplyr)
require(gsubfn)
require(rvest)
require(xml2)
require(ggplot2)
library(sp)
library(maptools)
library(dendextend)
# Uvozimo funkcije za pobiranje in uvoz zemljevida.
library(shiny)
if ("server.R" %in% dir()) {
setwd("..")
}
| library(knitr)
library(ggplot2)
library(dplyr)
require(gsubfn)
require(rvest)
require(xml2)
require(ggplot2)
library(sp)
library(maptools)
library(dendextend)
# Uvozimo funkcije za pobiranje in uvoz zemljevida.
source("lib/uvozi.zemljevid.r", encoding = "UTF-8")
source("podatki/podatki.r", encoding = "UTF-8")
source(... | mit | R |
203ebdc2af759b2ac3a10698fb79dad576b33cc6 | set script 1 to retrieve clim from quicc_db | QUICC-FOR/STModel-Strip | 1_getFutClim.r | 1_getFutClim.r | # open the db connection
source('./con_quicc_db.r')
# load libs
library("RPostgreSQL")
# read list of GCMs
GCM_df <- read.csv("./data/list_GCM.csv")
GCM_df <- subset(GCM_df, scenario == 'rcp85')
windows <- seq(2000,2095,5)
out_folder <- "./out_files/futClimSTM/"
for (x in 1:dim(GCM_df)[1]){
system(paste("mkdir ... | # open the db connection
source('./con_quicc_db.r')
# load libs
library("RPostgreSQL")
# read list of GCMs
GCM_df <- read.csv("./data/list_GCMs.csv")
GCM_df <- subset(GCM_df, scenario == 'rcp85')
windows <- seq(2000,2095,5)
out_folder <- "./data/futClimSTM/"
for (x in 1:dim(GCM_df)[1]){
system(paste("mkdir -p "... | mit | R |
b81299734b2ee1d9ae737b45ef901178c87a12d6 | Update Clean.r | ericward/TRACC | Clean.r | Clean.r | source('TRACC_functions.r')
temp<-rt.file()
SF<-temp$SF
outfile<-temp$outfile
year<-temp$year
doy<-temp$doy
hhmm<-temp$hhmm
Temp<-temp$Temp
VPD<-temp$VPD
stsn<-temp$stsn
dx<-dim(SF)
dpx<-2000
flag<-as.numeric(readline('Change window width? (1 for yes/0 for no)'))
while(flag!=1&flag!=0|is.na(flag)){
flag<-as.numeric(... | source('TRACC_functions.r')
temp<-rt.file()
SF<-temp$SF
outfile<-temp$outfile
year<-temp$year
doy<-temp$doy
hhmm<-temp$hhmm
Temp<-temp$Temp
VPD<-temp$VPD
stsn<-temp$stsn
dx<-dim(SF)
dpx<-2000
flag<-as.numeric(readline('Change window width? (1 for yes/0 for no)'))
while(flag!=1&flag!=0|is.na(flag)){
flag<-as.numeric(... | mit | R |
350ae4f1e728d6044e44bf58a8c4a0d16009eb4f | add comment | koji-to/effort_calculator,koji-to/effort_calculator,koji-to/effort_calculator | generate_git_clone_sh.r | generate_git_clone_sh.r | ####### generate .sh script for "git clone"
##### Set git directory structure file path
gitweb<-"https://git.chromium.org/gitweb/?a=project_index"
#####
shell.df<-read.csv(gitweb,header=F)
### save git repository tree in local
write.table(shell.df,"chromium_git_repo_tree.txt",col.names=F,row.names=F,quote=F,append=F)
... | ####### generate .sh script for "git clone"
##### Set git directory structure file path
gitweb<-"https://git.chromium.org/gitweb/?a=project_index"
#####
shell.df<-read.csv(gitweb,header=F)
### save git repository tree in local
write.table(shell.df,"chromium_git_repo_tree.txt",col.names=F,row.names=F,quote=F,append=F)
... | mit | R |
6d1445c8b3090bb52b4572bbed1dc8c52c2c005d | Fix solution | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr... | solutions/uri/1002/1002.r | solutions/uri/1002/1002.r | input <- file('stdin', 'r')
n <- as.double(readLines(input, n=1))
result = sprintf("A=%.4f", n * n * 3.14159)
write(result, "")
| input <- file('stdin', 'r')
n <- as.integer(readLines(input, n=1))
write(
paste(
"A=",
format(
n * n * 3.14159,
nsmall=4
),
sep=""
),
''
)
| mit | R |
7e859f7f7cdca8b154a5d6234a75ceb25638c830 | Fix #90 | klmr/modules,klmr/modules | R/module_file.r | R/module_file.r | #' Find the full file names of files in modules
#'
#' @param ... character vectors of files or subdirectories inside a module; if
#' none is given, return the root directory of the module
#' @param module a module environment (default: current module)
#' @param mustWork logical; if \code{TRUE}, an error is raised if t... | #' Find the full file names of files in modules
#'
#' @param ... character vectors of files or subdirectories inside a module; if
#' none is given, return the root directory of the module
#' @param module a module environment (default: current module)
#' @param mustWork logical; if \code{TRUE}, an error is raised if t... | apache-2.0 | R |
af5c3dcdb4342a0fb8551e1d9e828567ae0393b9 | Implement tAI | klmr/codons,klmr/codons | scripts/tai.r | scripts/tai.r | # Based on the paper by Dos Reis & al, 2004
s = list(naive = c(0, 0, 0, 0, 0.5, 0.5, 0.75, 0.5, 0.5, 0.5),
human = c(0, 0, 0, 0, 0.41, 0.28, 0.9999, 0.68, 0.89))
# Reverse complement of the anticodons, in the order of anticodons as given in
# Figure 1 of dos Reis & al.
rc_anticodons = c('TTT', 'TTC', 'TTA', ... | # Based on the paper by Dos Reis & al, 2004
s = list(naive = c(0, 0, 0, 0, 0.5, 0.5, 0.75, 0.5, 0.5, 0.5),
human = c(0, 0, 0, 0, 0.41, 0.28, 0.9999, 0.68, 0.89))
# Reverse complement of the anticodons, in the order of anticodons as given in
# Figure 1 of dos Reis & al.
rc_anticodons = c('TTT', 'TTC', 'TTA', ... | apache-2.0 | R |
0d07786653c816253230bb4602508c53a6782b91 | allow copy parameter in export stage | syberia/syberia | R/export_stage.r | R/export_stage.r | #' Export stage for Syberia.
#'
#' Precise behavior depends on adapter.
#'
#' @param modelenv an environment. The current modeling environment.
#' @param export_options a list. The available export options. Will differ
#' depending on the adapter. (default is file adapter)
#' @export
export_stage <- function(modele... | #' Export stage for Syberia.
#'
#' Precise behavior depends on adapter.
#'
#' @param modelenv an environment. The current modeling environment.
#' @param export_options a list. The available export options. Will differ
#' depending on the adapter. (default is file adapter)
#' @export
export_stage <- function(modele... | mit | R |
8aac0853e768c88f48592a4813d2b82321cd3d9c | Fix hashing of functions | klmr/codons,klmr/codons | scripts/cache.r | scripts/cache.r | decorate = modules::import('decorate', attach = TRUE)
modules::import('ebits/base', attach = c('closure', 'match_call_defaults'))
# FIXME: Doesn’t work with recursive functions
# Reproduce: fib = .cache %@% function (n) if (n < 2) 1 else fib(n - 1) + fib(n - 2)
# Suspicion: somehow, the state of the function is shared... | decorate = modules::import('decorate', attach = TRUE)
modules::import('ebits/base', attach = c('closure', 'match_call_defaults'))
# FIXME: Doesn’t work with recursive functions
# Reproduce: fib = .cache %@% function (n) if (n < 2) 1 else fib(n - 1) + fib(n - 2)
# Suspicion: somehow, the state of the function is shared... | apache-2.0 | R |
fdc030e094f89be507e8c14545a195abfee44a83 | test implementation of modular system | wikimedia-research/Blockr | main.r | main.r | #Blockr - a project to accurately triage data on blocked Wikipedia users, identify
#the underlying rationales and test various hypotheses as to any outcome
#
# @Year = 2013
# @Copyright: Oliver Keyes
# @License = MIT (http://opensource.org/licenses/MIT)
#Load
source(file = file.path(getwd(),"config.r")) #Config variab... | #Blockr - a project to accurately triage data on blocked Wikipedia users, identify
#the underlying rationales and test various hypotheses as to any outcome
#
# @Year = 2013
# @Copyright: Oliver Keyes
# @License = MIT (http://opensource.org/licenses/MIT)
#Load
source(file = file.path(getwd(),"config.r")) #Config variab... | mit | R |
dd0b0c2bd6f4da8e9ab96c24d71fc986cd681f77 | Install data.table if it isn't present yet | NTAP/warpcore,NTAP/warpcore,NTAP/warpcore,NTAP/warpcore | analyze.r | analyze.r | #! /usr/bin/env Rscript
if ("data.table" %in% rownames(installed.packages(lib="~/.R")) == FALSE) {
install.packages("data.table", lib="~/.R",
repos="http://cran.r-project.org")
}
library(data.table, lib="~/.R")
printf <- function(...) cat(sprintf(...))
import <- function(file) {
dt <- data.table:... | #! /usr/bin/env Rscript
library(data.table)
printf <- function(...) cat(sprintf(...))
import <- function(file) {
dt <- data.table::fread(file)
dt[, nsec:=nsec/1000]
stats <- dt[order(size), list(n=length(nsec), min=min(nsec), max=max(nsec),
mean=mean(nsec), sd=sd(nsec),
median=as.double(median(nsec)),... | bsd-2-clause | R |
afa5e0eb3bedb5b03ca92980ebc6258053b92993 | Add another test | jarrodmillman/example-knitr | example/test.r | example/test.r | options(device=pdf)
source("example.r")
test_that("x and y are set correctly", {
expect_that(length(x), equals(100))
expect_that(length(y), equals(100))
})
test_that("too_many_na works correctly", {
# test argument checking
expect_that(too_many_na(), throws_error())
testdf0 = data.frame(as.character(... | options(device=pdf)
source("example.r")
test_that("x and y are set correctly", {
expect_that(length(x), equals(100))
expect_that(length(y), equals(100))
})
test_that("too_many_na works correctly", {
# test argument checking
expect_that(too_many_na(), throws_error())
testdf0 = data.frame(as.character(... | bsd-2-clause | R |
79a92cbf166ae548e6ce62e3efbe5e2be1d02ecb | Add colored plot points | thoolihan/GoogleAnalyticsRExample | explore.r | explore.r |
data <- read.csv("~/workspace/data/ga2-hoolihan.csv", sep=",")
with(data, {
Day.Index <- as.Date(Day.Index, format="%m/%d/%Y")
plot(Day.Index,
Pageviews,
xlab = "Date",
type = "b",
col = "blue",
pch = 21,
bg = "navy",
main = "Googl... |
data <- read.csv("~/workspace/data/ga2-hoolihan.csv", sep=",")
with(data, {
Day.Index <- as.Date(Day.Index, format="%m/%d/%Y")
plot(Day.Index,
Pageviews,
xlab = "Date",
type = "b",
col = "blue",
main = "Google Analytics",
ylim = c(0, 200))
... | unlicense | R |
06ff8f67cb01bbcf7c3a0013b5732b06eeaf9cef | add expand_grid arg | mschubert/narray,mschubert/narray | R/lambda.r | R/lambda.r | #' Lambda syntax for array iteration
#'
#' @param fml A call prefixed with a tilde
#' @param along A named vector which objects to subset (eg: c(x=1))
#' @param group Not implemented
#' @param simplify Return array instead of index+result if scalar
#' @param envir Environment where variables can be f... | #' Lambda syntax for array iteration
#'
#' @param fml A call prefixed with a tilde
#' @param along A named vector which objects to subset (eg: c(x=1))
#' @param group Not implemented
#' @param simplify Return array instead of index+result if scalar
#' @param envir Environment where variables can be f... | apache-2.0 | R |
4faadb1c755ac8b59954aecd3f6524035511ef58 | Update package documentation | Nektar-io/LvWS | R/api-methods.r | R/api-methods.r | #' Get XML
#'
#' Get XML data from the API.
#'
#' @param path URL path
#' @param query URL query
get_xml <- function(path, query) {
url <- modify_url(
url = .url,
path = file.path(.path, path),
query = query
)
x <- paste(readLines(url, warn = FALSE), collapse="")
xmlParse(x)
}
... | library(XML)
library(httr)
#' Get XML
#'
#' Get XML data from the API.
#'
#' @param path URL path
#' @param query URL query
get_xml <- function(path, query) {
url <- modify_url(
url = .url,
path = file.path(.path, path),
query = query
)
x <- paste(readLines(url, warn = FALSE), col... | agpl-3.0 | R |
0111b640a4f14519121dc7928940f9b3143a78f6 | Update 1.r | glor/R,glor/R | aufgaben/blatt04/1.r | aufgaben/blatt04/1.r | #4.2
t.test(formula = hair$length_difference ~ hair$type, var.eqaul = TRUE, alternative = "two.sided", conf.level = 0.95, paired = TRUE)
| bsd-2-clause | R | |
b533878584b3354d1e3f5d28ae26e8ecac923551 | Package Renaming | felixlindemann/HNUORTools,felixlindemann/HNUORTools | R/00init.r | R/00init.r | # environment in package namespace used to save package
# settings
.HNUORToolsEnv <- new.env()
assign("settings", list(), envir = .HNUORToolsEnv)
assign("nodes", list(), envir = .HNUORToolsEnv)
assign("customers", list(), envir = .HNUORToolsEnv)
assign("warehouses", list(), envir = .HNUORToolsEnv)
.onAttach <- fu... | # environment in package namespace used to save package
# settings
.HNUORToolsEnv <- new.env()
assign("settings", list(), envir = .HNUORToolsEnv)
assign("nodes", list(), envir = .HNUORToolsEnv)
assign("customers", list(), envir = .HNUORToolsEnv)
assign("warehouses", list(), envir = .HNUORToolsEnv)
.onAttach <- fu... | mit | R |
92181aa95fd2fefdbc4dbca2466e87f3753f2b42 | Define re-write, increasing legibility and adding optional packages parameter | robertzk/Ramd | R/define.r | R/define.r | #' Load a bunch of dependencies by filename
#'
#' This is useful for reducing pollution in the global namespace,
#' and not loading multiple files twice unnecessarily.
#'
#' @export
#' @examples
#' \dontrun{
#' helper_fn <- define('some/dir/helper_fn')
#' define(c('some/dir/helper_fn', 'some/other_dir/library_fn'), fu... | #' Load a bunch of dependencies by filename
#'
#' This is useful for reducing pollution in the global namespace,
#' and not loading multiple files twice unnecessarily.
#'
#' @param dependencies list of dependencies
#' @param fn function whose argument cardinality matches that of dependencies
#' @export
#' @examples
#'... | mit | R |
671182f06db8181a8fb53985476c9b22cb5f2e6e | Modify args example | tisp-lang/tisp,raviqqe/tisp,raviqqe/tisp,raviqqe/tisp,tisp-lang/tisp | examples/args.r | examples/args.r | (let kwargs {'y5 123 'y6 456})
(let args '(1 2 3 4 "foo-bar-baz"))
; This is comment!!!
((\ (x1 x2 (x3 123) (x4 456) args.. y1 (y2 123) y3 (y4 456) kwargs...) 42)
1 2 3 4 args.. y1 123 y3 456 kwargs...)
| (let kwargs {'y5 123 'y6 456})
((\ (x1 x2 (x3 123) (x4 456) args.. y1 (y2 123) y3 (y4 456) kwargs...) x)
1 2 3 4 list.. . y1 123 y3 456 kwargs...)
; We don't have to support neither `*[123 456]` nor `**{'y5 123 'y6 456}`
; because they can just be expanded into arguments directly.
; (e.g. `(func 123 456 * y5 123 y6 ... | mit | R |
4decc84c210adce3a30022664ad38be30e4dec5d | Tweak plots (densities -> histograms). | jtobin/bnp | finite-gaussian-mixture/src/simulation_conditional.r | finite-gaussian-mixture/src/simulation_conditional.r | set.seed(990909)
require(ggplot2)
require(gridExtra)
require(reshape2)
source('fmm_conditional.r')
config = list(
k = 3
, a = 1
, l = 0
, r = 0.01
, b = 1
, w = 1
, n = 1000
)
origin = list(
p = mixing_model(config$k, config$a)
, m = location_model(config$k, config$l, config$r)
, s = preci... | set.seed(42)
require(ggplot2)
require(reshape2)
source('fmm_conditional.r')
config = list(
k = 3
, a = 1
, l = 0
, r = 0.1
, b = 1
, w = 1
, n = 1000
)
origin = list(
p = mixing_model(config$k, config$a)
, m = location_model(config$k, config$l, config$r)
, s = precision_model(config$k, con... | mit | R |
d6c188200aca02025fc295d51697046b139fd241 | set scope for function call | MikeXL/bayes | R/best.r | R/best.r | ttest.fun <- function(theta, x, y) {
# parameters
mu1 <- theta[1]
sd1 <- theta[2]
mu2 <- theta[3]
sd2 <- theta[4]
nu <- theta[5]
# no negative standard deviations, right?!
if(sd1 <=0 | sd2 <= 0) { return(-Inf) }
# priors
sigma <- sd(c(x,y))
log.prior <- dnorm(mu1, sd=1e6*sigma, log=T) + ... | ttest.fun <- function(theta, x, y) {
# parameters
mu1 <- theta[1]
sd1 <- theta[2]
mu2 <- theta[3]
sd2 <- theta[4]
nu <- theta[5]
# no negative standard deviations, right?!
if(sd1 <=0 | sd2 <= 0) { return(-Inf) }
# priors
sigma <- sd(c(x,y))
log.prior <- dnorm(mu1, sd=1e6*sigma, log=T) + ... | mit | R |
2f0a8f97811e4247c18a0d9b03748644e224de48 | use specific deprecating warning (#114) | mschubert/clustermq,mschubert/clustermq,mschubert/clustermq | R/workers.r | R/workers.r | #' Creates a pool of workers
#'
#' @param n_jobs Number of jobs to submit (0 implies local processing)
#' @param data Set common data (function, constant args, seed)
#' @param reuse Whether workers are reusable or get shut down after call
#' @param template A named list of values to fill in templat... | #' Creates a pool of workers
#'
#' @param n_jobs Number of jobs to submit (0 implies local processing)
#' @param data Set common data (function, constant args, seed)
#' @param reuse Whether workers are reusable or get shut down after call
#' @param template A named list of values to fill in templat... | apache-2.0 | R |
5036396a78a07bbf82078be856a4bb979a91059a | Fix typo with id var | vikjam/bcstatsR | R/bcstats.r | R/bcstats.r | #' Comparing "back checks" in R (a clone of Stata's bcstats)
#'
#' @param surveydata The survey data
#' @param bcdata The back check data
#' @param id the unique ID
#' @param t1vars The list of "type 1" variables
#' @param t2vars The list of "type 2" variables
#' @param t3vars The list of "type 3" variables
#' @return... | #' Comparing "back checks" in R (a clone of Stata's bcstats)
#'
#' @param surveydata The survey data
#' @param bcdata The back check data
#' @param id the unique ID
#' @param t1vars The list of "type 1" variables
#' @param t2vars The list of "type 2" variables
#' @param t3vars The list of "type 3" variables
#' @return... | mit | R |
fd3778f4ca75f3c5a45e46e67c3acd8c344b3d25 | Update help language in find_globals | jmousseau/Stain | R/globals.r | R/globals.r | #' Find unassigned global variables.
#'
#' This funciton sources files and loads objects into an environment
#' and then runs \code{codetools::findGlobals} on the environment.
#'
#' NOTE: Globals are determined for the \code{main()} function only!
#'
#' @param source_files R files containing globals to exclude such as
... | #' Find unassigned global variables.
#'
#' This funciton sources files and loads objects into an environment
#' and then runs \code{codetools::findGlobals} on the environment.
#'
#' NOTE: Globals are determined for the \code{main()} function only!
#'
#' @param source_files R files containing globals to exclude such as
... | mit | R |
4cd4be71f3c88b48735906d080d6e6a65cfc5738 | Improve color in plots. | jtobin/bnp | finite-gaussian-mixture/src/simulation_multivariate_conditional.r | finite-gaussian-mixture/src/simulation_multivariate_conditional.r | require(ggplot2)
require(gridExtra)
require(reshape2)
source('fmm_multivariate_conditional.r')
dimension = 2
config = list(
k = 3
, m = dimension
, a = 1
, l = rep(0, dimension)
, r = diag(0.05, dimension)
, b = 2
, w = diag(1, dimension)
, n = 1000
)
set.seed(222)
d = list(
t(replicate(250... | require(ggplot2)
require(gridExtra)
require(reshape2)
source('fmm_multivariate_conditional.r')
dimension = 2
config = list(
k = 3
, m = dimension
, a = 1
, l = rep(0, dimension)
, r = diag(0.05, dimension)
, b = 2
, w = diag(1, dimension)
, n = 1000
)
set.seed(222)
d = list(
t(replicate(250... | mit | R |
79850a402320e2fa8436a4e7a11e820165a39a1a | fix CRAN winbuilder | mschubert/clustermq,mschubert/clustermq,mschubert/clustermq | tests/testthat/test-qsys.r | tests/testthat/test-qsys.r | context("qsys")
test_that("control flow", {
skip_on_os("windows")
fx = function(x) x*2
r = Q(fx, x=1:3, workers=workers(n_jobs=1, qsys_id="multicore", reuse=FALSE))
expect_equal(r, as.list(1:3*2))
})
test_that("common data", {
skip_on_os("windows")
fx = function(x, y) x*2 + y
r = Q(fx, x=1... | context("qsys")
skip_on_os("windows")
test_that("control flow", {
fx = function(x) x*2
r = Q(fx, x=1:3, workers=workers(n_jobs=1, qsys_id="multicore", reuse=FALSE))
expect_equal(r, as.list(1:3*2))
})
test_that("common data", {
fx = function(x, y) x*2 + y
r = Q(fx, x=1:3, const=list(y=10),
... | apache-2.0 | R |
35c98f14c01a8949632dda93a6362124ad6e9149 | Fix typo in R package path | klmr/.files,klmr/.files,klmr/.files | .R/config.r | .R/config.r | options(pager = file.path(Sys.getenv('HOME'), '.R/pager.sh'),
# Imperial College London
repos = c(CRAN = 'http://cran.ma.imperial.ac.uk/'),
menu.graphics = FALSE, # Seriously, WHAT THE FUCK, R!?
import.path = '~/.R/modules',
devtools.name = 'Konrad Rudolph',
devtools.desc... | options(pager = file.path(Sys.getenv('HOME'), '.R/pager.sh'),
# Imperial College London
repos = c(CRAN = 'http://cran.ma.imperial.ac.uk/'),
menu.graphics = FALSE, # Seriously, WHAT THE FUCK, R!?
import.path = '~/.R/modules',
devtools.name = 'Konrad Rudolph',
devtools.desc... | apache-2.0 | R |
1d4445f5c372f17022d5ab03253d3c7daefb41b9 | Add R shebang | tsee/dumbbench,tsee/dumbbench,tsee/dumbbench | r/boxplot.r | r/boxplot.r | #!/usr/bin/r
# r --slave --quiet --args *.dat < boxplot.r
file <- commandArgs(trailingOnly=T)[1]
print( file )
t <- read.table(
file,
sep="\t",
header=T,
fill=T
)
base <- sub( "(^[^.]+).*", "\\1", file )
image <- paste( base, "png", sep="." )
png( image )
p <- list(
bo... | file <- commandArgs(trailingOnly=T)[1]
print( file )
t <- read.table(
file,
sep="\t",
header=T,
fill=T
)
base <- sub( "(^[^.]+).*", "\\1", file )
image <- paste( base, "png", sep="." )
png( image )
p <- list(
boxwex = 0.1,
ylab = "Times, s"
)
boxplot(... | artistic-2.0 | R |
353f1d88410b9ba30e83f83e24ad7fa14ef6cd20 | Use idiomatic do.call. | jtobin/bnp | indian-buffet-process/src/ibp.r | indian-buffet-process/src/ibp.r |
ibp = function(n, a) {
dishes = max(1, rpois(1, a))
diners = data.frame(dish = seq(dishes), diners = rep(1, dishes))
buffet = list(buffet = diners, choices = list(seq(dishes)))
for (j in seq(n - 1)) {
buffet = arrival(buffet, a)
}
buffet
}
arrival = function(b, a) {
config = b$buffet
exis... |
ibp = function(n, a) {
dishes = max(1, rpois(1, a))
diners = data.frame(dish = seq(dishes), diners = rep(1, dishes))
buffet = list(buffet = diners, choices = list(seq(dishes)))
for (j in seq(n - 1)) {
buffet = arrival(buffet, a)
}
buffet
}
arrival = function(b, a) {
config = b$buffet
existi... | mit | R |
08a02b6a9bd6e83dda03b68fdea3dac3e6a9aefd | Update clomin_7730.r | alfcrisci/rBiometeo,alfcrisci/rBiometeo | R/clomin_7730.r | R/clomin_7730.r | #' clomin_7730
#'
#' Calculate minimal clothing insulation value needed for thermal comfort in moderate thermal environments based on PMV ISO 7730.
#'
#' @param numeric t Air temperature in Celsius degrees.
#' @param numeric rh Air Relative humidity in percentage.
#' @param numeric wind Wind speed in meter per second.
... | #' clomin_7730
#'
#' Calculate minimal clothing insulation value needed for thermal comfort in moderate thermal environments based on PMV ISO 7730.
#'
#' @param numeric t Air temperature in Celsius degrees.
#' @param numeric rh Air Relative humidity in percentage.
#' @param numeric wind Wind speed in meter per second.
... | mit | R |
8c3b3ef0bd725e1f9ffc2a925bb7f938ebcab146 | Update sun_data.r | alfcrisci/rBiometeo,alfcrisci/rBiometeo | R/sun_data.r | R/sun_data.r | #' sun_data
#'
#' Calculate solar parameter for a location and a time.
#'
#' @param datetime Datetime as in "%Y-%m-%d %H:%M:%S" format
#' @param numeric lat Latitude in decimal degrees.
#' @param numeric lon Longitude in decimal degrees.
#' @param character parameter Six solar parameter are available by name "azimuth"... | #' sun_data
#'
#' Calculate solar parameter for a location and a time.
#'
#' @param datetime Datetime in format YYYY-MM-DD HH:MM:SS.
#' @param numeric lat Latitude in decimal degrees.
#' @param numeric lon Longitude in decimal degrees.
#' @param character parameter Six solar parameter are available by name "azimuth",... | mit | R |
b9dfe949d81a10e560d3b53076ae45d50965b3b9 | add ability to set recursive registry keys | syberia/syberia | R/registry.r | R/registry.r | get_registry_key <- function(key, registry_dir) {
key <- sanitize_registry_key(key, registry_dir)
(readRDS(filename)) # do not use default invisibility
}
set_registry_key <- function(key, value, registry_dir) {
key <- sanitize_registry_key(key, registry_dir, read = FALSE)
filename <- file.path(registry_dir, ke... | get_registry_key <- function(key, registry_dir) {
key <- sanitize_registry_key(key)
if (!file.exists(filename <- file.path(registry_dir, key)))
stop('There is no Syberia registry item with key "', key, '"')
(readRDS(filename)) # do not use default invisibility
}
set_registry_key <- function(key, value, regis... | mit | R |
b02725eb1a23fd2e7a858e4abdef8bb9f94d3e68 | Fix document. | snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3,snakamura/q3 | q3/docs/InputBoxFunction.rd | q3/docs/InputBoxFunction.rd | =begin
=@InputBox
String @InputBox(String message, Boolean multiline?, String default?)
==
[Uɓ͂߂邽߂̃_CAO\A͂ꂽԂ܂Bmessageɂ͕\郁bZ[Ww肵܂Bdefaultw肷ƃ_CAOJƂɂ͗̕ɕ\܂B
multilineɂ̓_CAÕ^Cvw肵܂Bwł͈̂ȉ̂ƂłB
::INPUT-SINGLELINE
Ps̓͂߂_CAO
((<Ps̓_CAO|"IMG:images/SingleLineInputBoxDialog.png">))
::INPUT-MULTILINE
... | =begin
=@InputBox
String @InputBox(String message, Boolean multiline?, String default?)
==
[Uɓ͂߂邽߂̃_CAO\A͂ꂽԂ܂Bmessageɂ͕\郁bZ[Ww肵܂Bdefaultw肷ƃ_CAOJƂɂ͗̕ɕ\܂B
multilineɂ̓_CAÕ^Cvw肵܂Bwł͈̂ȉ̂ƂłB
::INPUT-SINGLELINE
Ps̓͂߂_CAO
((<Ps̓_CAO|"IMG:images/SingleLineInputBoxDialog.png">))
::INPUT-MULTILINE
... | mit | R |
1e1278c69b70fb3848594a3b3dd4c30be4e44ced | fix math plot generation when no LRB data is available | VcDevel/Vc,VcDevel/Vc,chr-engwer/Vc,VcDevel/Vc,chr-engwer/Vc,VcDevel/Vc,chr-engwer/Vc | benchmarks/math.r | benchmarks/math.r | mathProcessData <- function(d) {
d <- processData(d, paste(d$datatype, d$benchmark.arch, d$benchmark.name),
pchkey = "benchmark.name")
if(length(d) > 0) d$key <- paste(d$datatype, d$benchmark.arch)
d
}
set1 <- function(d) {
if(length(d) == 0) return(NULL)
subset(d, !(d$benchmark.name == "rs... | mathProcessData <- function(d) {
d <- processData(d, paste(d$datatype, d$benchmark.arch, d$benchmark.name),
pchkey = "benchmark.name")
if(length(d) > 0) d$key <- paste(d$datatype, d$benchmark.arch)
d
}
set1 <- function(d) subset(d, !(d$benchmark.name == "rsqrt" | d$benchmark.name == "recip" | d$ben... | bsd-3-clause | R |
e4c283b3d90c9e99793d9ed7490f3c4c23e400b3 | Update windchill_cla.r | alfcrisci/rBiometeo,alfcrisci/rBiometeo | R/windchill_cla.r | R/windchill_cla.r | #' windchill_cla
#'
#' Calculates the risk class of Windchill index.
#'
#' @param t numeric Air temperature in degC.
#' @param wind numeric Windspeed in meters per second.
#' @return windchill index in degC
#'
#' @references Windchill Tables \url{https://www.canada.ca/en/environment-climate-change/services/weather-... | #' windchill_cla
#'
#' Calculates the risk class of Windchill index.
#'
#' @param t numeric Air temperature in degC.
#' @param wind numeric Windspeed in meters per second.
#' @return windchill index in degC
#'
#' @references Windchill Tables \url{https://www.canada.ca/en/environment-climate-change/services/weather-... | mit | R |
7b9e456b8709ba25a4cf7f1cdd6555fbd4dbb6d5 | Update template file | hkaju/Ising2D,hkaju/Ising2D,hkaju/Ising2D | templates/report.template.r | templates/report.template.r | pdf("reports/{run}.pdf")
data <- read.csv("data/{run}/results.csv", header=T)
par(mfrow=c(2,2))
plot(data$T, data$M, xlab="Temperature", ylab="Magnetization")
plot(data$T, data$E, xlab="Temperature", ylab="Energy")
plot(data$T, data$Xb, xlab="Temperature", ylab="Magnetic susceptibility")
plot(data$T, data$Xt,... | pdf("{filename}")
data <- read.csv("results.csv", header=T)
par(mfrow=c(2,2))
plot(data$T, data$M, xlab="Temperature", ylab="Magnetization")
plot(data$T, data$E, xlab="Temperature", ylab="Energy")
plot(data$T, data$Xb, xlab="Temperature", ylab="Magnetic susceptibility")
plot(data$T, data$Xt, xlab="Temperature... | mit | R |
f6f14089b86c14bb6bf98e9592c80949f57cea6d | Add a Fisher test for layout vs plain | charlieegan3/points-extraction,charlieegan3/points-extraction,charlieegan3/points-extraction,charlieegan3/standpoint,charlieegan3/points-extraction,charlieegan3/standpoint,charlieegan3/points-extraction,charlieegan3/standpoint,charlieegan3/standpoint,charlieegan3/points-extraction,charlieegan3/standpoint | evaluation/r_analysis/sig_tests.r | evaluation/r_analysis/sig_tests.r | library(scales)
study1 = read.csv(file="study1.csv", header=TRUE, sep=",")
study2 = read.csv(file="study2.csv", header=TRUE, sep=",")
study2_extracts = read.csv(file="study2_extracts.csv", header=TRUE, sep=",")
successesFailures <- function(table, comparison, factor) {
print(sprintf("total: %i",sum(table[table$comp... | library(scales)
study1 = read.csv(file="study1.csv", header=TRUE, sep=",")
study2 = read.csv(file="study2.csv", header=TRUE, sep=",")
study2_extracts = read.csv(file="study2_extracts.csv", header=TRUE, sep=",")
successesFailures <- function(table, comparison, factor) {
print(sprintf("total: %i",sum(table[table$comp... | mit | R |
70b9c6b0818d5d03c354a178d37a7cdc83fa9664 | refactor multicore cleanup | mschubert/clustermq,mschubert/clustermq,mschubert/clustermq | R/qsys_multicore.r | R/qsys_multicore.r | #' Process on multiple cores on one machine
#'
#' This makes use of rzmq messaging and sends requests via TCP/IP
MULTICORE = R6::R6Class("MULTICORE",
inherit = QSys,
public = list(
initialize = function(...) {
super$initialize(..., node="localhost")
},
submit_jobs = functio... | #' Process on multiple cores on one machine
#'
#' This makes use of rzmq messaging and sends requests via TCP/IP
MULTICORE = R6::R6Class("MULTICORE",
inherit = QSys,
public = list(
initialize = function(...) {
super$initialize(..., node="localhost")
},
submit_jobs = functio... | apache-2.0 | R |
31dea2f388a98de9d57f5fbe49f9b82386892116 | Make the default sbatch options more reasonable | jmousseau/Stain | R/slurm-settings.r | R/slurm-settings.r | #' SlurmSettings R6 object.
#'
#' An interface to SBATCH settings.
SlurmSettings <- R6::R6Class("SlurmSettings",
public = list(
options = c(sbatch_opts$nodes(1),
sbatch_opts$memory("8g"),
sbatch_opts$cpus_per_task(1),
sbatch_opts$time("00:30:00")),... | #' SlurmSettings R6 object.
#'
#' An interface to SBATCH settings.
SlurmSettings <- R6::R6Class("SlurmSettings",
public = list(
options = c(sbatch_opts$nodes(1),
sbatch_opts$memory("16g"),
sbatch_opts$cpus_per_task(12),
sbatch_opts$time("00:30:00")... | mit | R |
cceed79773903d37e88eea655e47cdabc0637d4d | Fix test check error | klmr/modules,klmr/modules | tests/testthat/test-basic.r | tests/testthat/test-basic.r | context('Basic import test')
test_that('module can be imported', {
a = import('a')
expect_true(is_module_loaded(module_path(a)))
expect_true('double' %in% ls(a))
})
test_that('import works in global namespace', {
local({
# Necessary since private names are not exported to global environment
... | context('Basic import test')
test_that('module can be imported', {
a = import('a')
expect_true(is_module_loaded(module_path(a)))
expect_true('double' %in% ls(a))
})
test_that('import works in global namespace', {
local({
a = import('a')
on.exit(unload(a)) # To get rid of attached opera... | apache-2.0 | R |
e148cbeae554e0dab7e7fb5c3d9af79cc18093c6 | Fix MOE & sampleSize with finite N | daigotanaka/r-utils | binomial.r | binomial.r | marginOfError =
function(prob, # sample probability (or response rate)
n, # sample size
N=NULL,
conf.level=0.95 # Confidence interval
) {
z <- qnorm(p=1.0 - (1.0 - conf.level) * 0.5)
B <- prob * (1 - prob)
moe <- z * sqrt(B / n)
if (!is.null(N)) {
# tmp <-... | marginOfError =
function(prob, # sample probability (or response rate)
n, # sample size
N=NULL,
conf.level=0.95 # Confidence interval
) {
z <- qnorm(p=1.0 - (1.0 - conf.level) * 0.5)
moe <- z * sqrt(prob * (1 - prob) / n)
if (!is.null(N)) {
# tmp <- z ^ 2 * (p... | mit | R |
b93551dbbea1c714468e3f73b984dfed67186dca | Update processingDF.r | svobodam/Deep-Learning-Text-Summariser,svobodam/Deep-Learning-Text-Summariser,svobodam/Deep-Learning-Text-Summariser | PreProcessingScript/processingDF.r | PreProcessingScript/processingDF.r | # Author: Matej Svoboda
# Data Frame processing
# Dataset used as .db file to allow managing DF from Python and R.
# This process process dataset to remove html tags.
# ***FUNCTIONS***
# Function which transorm DS to Corpus and preprocess it.
dfCorpusFN = function(data_frame) {
c = Corpus(VectorSource(data_frame))... | # Author: Matej Svoboda
# Data Frame processing
# Dataset used as .db file to allow managing DF from Python and R.
# This process process dataset to remove html tags.
# ***FUNCTIONS***
# Function which transorm DS to Corpus and preprocess it.
dfCorpusFN = function(data_frame) {
c = Corpus(VectorSource(data_frame))... | mit | R |
a331f760348496a9bf3c4ba3d85741266e2078f7 | Add SQL list routine. | owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus | r/dbtools.r | r/dbtools.r | # Generic query wrapper to keep the MySQL nastiness out of the code.
dbquery <- function(db, query, mysqlhost="mysql.external.legion.ucl.ac.uk", mysqlport = 3306) {
# Pull in the RMySQL library and my tool for reading Python ini files.
(library(RMySQL))
source("r/pyconfconv.r")
# Get authentication information.
... | # Generic query wrapper to keep the MySQL nastiness out of the code.
dbquery <- function(db, query, mysqlhost="mysql.external.legion.ucl.ac.uk", mysqlport = 3306) {
# Pull in the RMySQL library and my tool for reading Python ini files.
(library(RMySQL))
source("r/pyconfconv.r")
# Get authentication information.
... | mit | R |
c60e04be5cbab4b97d994d11c363f29a88e7fec9 | Store also metadatas & make dates date objects | HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core | hybra/plugin/stm/stm.r | hybra/plugin/stm/stm.r | library(stm)
library(lubridate)
md <- data.frame( timestamp = ymd_hms( timestamps ) )
processed <- textProcessor( documents, metadata = md, stem = FALSE, striphtml = TRUE, language = NA, customstopwords = stopwords )
## todo: set upper and lower thresholds
out <- prepDocuments(processed$documents, processed$vocab, p... | library(stm)
md <- data.frame( timestamp = timestamps )
processed <- textProcessor( documents, metadata = md, stem = FALSE, striphtml = TRUE, language = NA, customstopwords = stopwords )
## todo: set upper and lower thresholds
out <- prepDocuments(processed$documents, processed$vocab, processed$meta, lower.thresh= 2... | mit | R |
c0e828eced34ade177e5e4649fdc5d6b7bee389e | remove cutoff | shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl | lib/scRNA/split_samples_seurat_all.r | lib/scRNA/split_samples_seurat_all.r | source("split_samples_utils.r")
library(Seurat)
library(ggplot2)
files_lines=read.table(parSampleFile1, sep="\t")
files=split(files_lines$V1, files_lines$V2)
params_lines=read.table(parSampleFile3, sep="\t")
params=split(params_lines$V1, params_lines$V2)
params$hto_ignore_exists=ifelse(params$hto_ignore_exists=="0",... | source("split_samples_utils.r")
library(Seurat)
library(ggplot2)
files_lines=read.table(parSampleFile1, sep="\t")
files=split(files_lines$V1, files_lines$V2)
cutoffs_lines=read.table(parSampleFile2, sep="\t")
cutoffs=split(cutoffs_lines$V1, cutoffs_lines$V2)
params_lines=read.table(parSampleFile3, sep="\t")
params=... | apache-2.0 | R |
a5efea8dcb79719d25d8e7b4ee42302dc4d63f2e | Update slavicreview.r | YaleDHLab/lab-workshops,YaleDHLab/lab-workshops,YaleDHLab/lab-workshops,YaleDHLab/lab-workshops,YaleDHLab/lab-workshops | rstudio_dfrtopics/slavicreview.r | rstudio_dfrtopics/slavicreview.r | #Create a new project in the folder that has the JSTOR data.
install.packages("devtools")
install_github("agoldst/dfrtopics")
install.packages("dplyr")
install.packages("ggplot2")
install.packages("lubridate")
install.packages("stringr")
install.packages("rJava")
install.packages("mallet")
library(devtools)
options... | #Create a new project in the folder that has the JSTOR data.
install.packages("devtools")
install_github("agoldst/dfrtopics")
install.packages("dplyr")
install.packages("ggplot2")
install.packages("lubridate")
install.packages("stringr")
install.packages("rJava")
install.packages("mallet")
library(devtools)
options... | mit | R |
cba101d28cc5778077dd6d84526caffad2c826d4 | Fix this test. | robertzk/microserver,robertzk/microserver | tests/testthat/test-routes.r | tests/testthat/test-routes.r | library(testthatsomemore)
context("determine_route")
test_that("it determines the root 404 route for a trivial example", {
expect_identical(determine_route(list(), "")()$status, 404)
})
test_that("it determines the ping route for a simple example", {
expect_identical(determine_route(list("/ping" = function() "Hel... | library(testthatsomemore)
context("determine_route")
test_that("it determines the root 404 route for a trivial example", {
expect_identical(determine_route(list(), "")()$status, 404)
})
test_that("it determines the ping route for a simple example", {
expect_identical(determine_route(list("/ping" = function() "Hel... | mit | R |
c96773bd9d9565e72ef35e4920f2c6346af8e96f | Update heat_risk_level.r | alfcrisci/rBiometeo,alfcrisci/rBiometeo | R/heat_risk_level.r | R/heat_risk_level.r | #' heat_risk_level
#'
#' Calculate the heat risk level for worker as four classes level.
#'
#' @param wbgt numeric Wetbulb globe temperature index in degC
#' @param cav numeric Clothing adjusted value due to worker clothing ensemble
#' @param tresh numeric treshshold for heat risk in degC ( RAL or REL)
#'
#' @return nu... | #' heat_risk_level
#'
#' Calculate the heat risk level for worker as four classes level.
#'
#' @param wbgt numeric Wetbulb globe temperature index in degC
#' @param cav numeric Clothing adjusted value due to worker clothing ensemble
#' @param tresh numeric treshshold for heat risk in degC ( RAL or REL)
#'
#' @return nu... | mit | R |
6af6dff7874a1168fbe8e09dc86b9d8f41b8b1cb | check for invalid hostname | mschubert/clustermq,mschubert/clustermq,mschubert/clustermq | tests/testthat/helper-util.r | tests/testthat/helper-util.r | send = function(sock, data) {
rzmq::send.socket(sock, data)
}
recv = function(p, sock, timeout=3L) {
event = rzmq::poll.socket(list(sock), list("read"), timeout=timeout)
if (is.null(event[[1]]))
return(recv(p, sock, timeout=timeout))
else if (event[[1]]$read)
rzmq::receive.socket(sock)
... | send = function(sock, data) {
rzmq::send.socket(sock, data)
}
recv = function(p, sock, timeout=3L) {
event = rzmq::poll.socket(list(sock), list("read"), timeout=timeout)
if (is.null(event[[1]]))
return(recv(p, sock, timeout=timeout))
else if (event[[1]]$read)
rzmq::receive.socket(sock)
... | apache-2.0 | R |
ebf1ce47a3f2adcf02659a34258dff7cdb8be5c6 | add mask performance (still slow, #26) | mschubert/narray,mschubert/narray | tests/testthat/test-mask.r | tests/testthat/test-mask.r | context("mask")
test_that("mask", {
F = list(a=c('e1','e2'),b='e1',c='e2')
Z = mask(F)
# e1 e2
# a TRUE TRUE
# b TRUE FALSE
# c FALSE TRUE
Zref = structure(c(TRUE, TRUE, FALSE, TRUE, FALSE, TRUE), .Dim = c(3L,
2L), .Dimnames = list(c("a", "b", "c"), c("e1", "e2")))
ex... | context("mask")
test_that("mask", {
F = list(a=c('e1','e2'),b='e1',c='e2')
Z = mask(F)
# e1 e2
# a TRUE TRUE
# b TRUE FALSE
# c FALSE TRUE
Zref = structure(c(TRUE, TRUE, FALSE, TRUE, FALSE, TRUE), .Dim = c(3L,
2L), .Dimnames = list(c("a", "b", "c"), c("e1", "e2")))
ex... | apache-2.0 | R |
492d52f81f7cdb9acdba879aeab54ff087a0d702 | Change exec status | etheleon/keggParser,shiva1387/keggParser,shiva1387/keggParser,etheleon/keggParser | kegg.0350.metabolic.r | kegg.0350.metabolic.r | #!/usr/bin/env Rscript
library(tidyverse)
args=commandArgs(T)
root = args[1]
K00000 = data.frame('ko:K00000', "Unassigned", "Unassigned", "ko", NA) %>%
setNames(c("ko:ID", "name", "definition", "l:label", "pathway"))
redun = Sys.glob(sprintf("%s/misc/*_konodes", root)) %>%
map(read_tsv) %>% bind_rows
me... | library(tidyverse)
args=commandArgs(T)
root = args[1]
K00000 = data.frame('ko:K00000', "Unassigned", "Unassigned", "ko", NA) %>%
setNames(c("ko:ID", "name", "definition", "l:label", "pathway"))
redun = Sys.glob(sprintf("%s/misc/*_konodes", root)) %>%
map(read_tsv) %>% bind_rows
merged = redun ... | mit | R |
4d3a235b3c7b4539bbc87f2e12f6c363c629ada7 | add package xml2 for R | felipenoris/AWSFinance,felipenoris/math-server-docker,felipenoris/math-server-docker,felipenoris/AWSFinance | libs/r-packages.r | libs/r-packages.r |
pkgs <- c(
"alabama",
"base64enc",
"caret",
"cubature",
"data.table",
"DEoptim",
"devtools",
"doParallel",
"doSNOW",
"dyn",
"dynlm",
"extrafont",
"fAsianOptions",
"fAssets",
"fBasics",
"fBonds",
"fCopulae",
"fExoticOptions",
"fExtremes",
"fGarch",
"fImport",
"fMultivar",
"fNonlinear",
"fOptions... |
pkgs <- c(
"alabama",
"base64enc",
"caret",
"cubature",
"data.table",
"DEoptim",
"devtools",
"doParallel",
"doSNOW",
"dyn",
"dynlm",
"extrafont",
"fAsianOptions",
"fAssets",
"fBasics",
"fBonds",
"fCopulae",
"fExoticOptions",
"fExtremes",
"fGarch",
"fImport",
"fMultivar",
"fNonlinear",
"fOptions... | mit | R |
892e314759d2f0360078b618d3479a008b982003 | Add R version of the onlimits code. | owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus | r/dbtools.r | r/dbtools.r | # Generic query wrapper to keep the MySQL nastiness out of the code.
dbquery <- function(db, query, mysqlhost="mysql.external.legion.ucl.ac.uk", mysqlport = 3306) {
# Pull in the RMySQL library and my tool for reading Python ini files.
(library(RMySQL))
source("r/rini.r")
# Get authentication information.
authd... | # Generic query wrapper to keep the MySQL nastiness out of the code.
dbquery <- function(db, query, mysqlhost="mysql.external.legion.ucl.ac.uk", mysqlport = 3306) {
# Pull in the RMySQL library and my tool for reading Python ini files.
(library(RMySQL))
source("r/rini.r")
# Get authentication information.
authd... | mit | R |
cc0c9d04ca0d7d6cbc20b6aeeb203dde4f407e79 | Fix issue with installation of package rhdf5 | SteveViss/OuranosDB,SteveViss/OuranosDB | install_dep.r | install_dep.r | # install dependancies
if(!require(rhdf5)){
source("http://bioconductor.org/biocLite.R")
biocLite("rhdf5")
}
if(!require(rgdal)){install.packages('rgdal',repos='http://cran.skazkaforyou.com/')}
if(!require(raster)){install.packages('raster',repos='http://cran.skazkaforyou.com/')}
if(!require(argparse)){install... | # install dependancies
if(!require(rhdf5)){install.packages('rhdf5',repos='http://cran.skazkaforyou.com/')}
if(!require(rgdal)){install.packages('rgdal',repos='http://cran.skazkaforyou.com/')}
if(!require(raster)){install.packages('raster',repos='http://cran.skazkaforyou.com/')}
if(!require(argparse)){install.packages... | mit | R |
4a80cf9ea3f7c9fd5a9db1511e166d428838d522 | Fix for strange testthat behavior - not entirely sure why the old code was wrong | mnpopcenter/ripums,mnpopcenter/ripums | tests/testthat/test_shape_join.r | tests/testthat/test_shape_join.r | context("ipums_shape_*_join work")
test_that("Basic join works (sf)", {
data <- read_nhgis(ripums_example("nhgis0008_csv.zip"), verbose = FALSE)
shape <- read_ipums_sf(ripums_example("nhgis0008_shape_small.zip"), verbose = FALSE)
joined <- ipums_shape_inner_join(data, shape, by = "GISJOIN")
expect_null(join_... | context("ipums_shape_*_join work")
test_that("Basic join works (sf)", {
data <- read_nhgis(ripums_example("nhgis0008_csv.zip"), verbose = FALSE)
shape <- read_ipums_sf(ripums_example("nhgis0008_shape_small.zip"), verbose = FALSE)
joined <- ipums_shape_inner_join(data, shape, by = "GISJOIN")
expect_null(join_... | mpl-2.0 | R |
7a1708d2e20d0227f683b767b68d49a4a2aae02e | Trim indentation from the error template | earl/rebol3 | scripts/shttpd.r | scripts/shttpd.r | REBOL [title: "A tiny static HTTP server" author: 'abolka date: 2009-11-04]
code-map: make map! [200 "OK" 400 "Forbidden" 404 "Not Found"]
mime-map: make map! [
"html" "text/html" "css" "text/css" "js" "application/javascript"
"gif" "image/gif" "jpg" "image/jpeg" "png" "image/png"
"r" "text/plain" "r3" "te... | REBOL [title: "A tiny static HTTP server" author: 'abolka date: 2009-11-04]
code-map: make map! [200 "OK" 400 "Forbidden" 404 "Not Found"]
mime-map: make map! [
"html" "text/html" "css" "text/css" "js" "application/javascript"
"gif" "image/gif" "jpg" "image/jpeg" "png" "image/png"
"r" "text/plain" "r3" "te... | apache-2.0 | R |
7a9adabd058dc8d124681b0e80bdaec01cb6df6e | Update data_stage.r | syberia/syberia | R/data_stage.r | R/data_stage.r | #' Data stage for syberia models
#'
#' TODO: Document this more
#'
#' @param modelenv an environment. The persistent modeling environment.
#' @param munge_procedure a list. A list of mungepiece arguments,
#' first preprocessed then passed to munge.
#' @export
data_stage <- function(modelenv, munge_procedure) {
re... | #' Data stage for syberia models
#'
#' TODO: Document this more
#'
#' @param modelenv an environment. The persistent modeling environment.
#' @param munge_procedure a list. A list of mungepiece arguments,
#' first preprocessed then passed to munge.
#' @export
data_stage <- function(modelenv, munge_procedure) {
re... | mit | R |
c1d6300ea1327593fc13449a610032de6fbac657 | Update south_sf.r | sequenceiq/r_datagen | clustering/south_sf.r | clustering/south_sf.r | #South SF, 6h, 12h and 18h clusters, #400000
#location
n1<-400
multiplier<-1
dev<-0.03
x<-c(rnorm(n1,mean=37.65338,sd=dev))
y<-c(rnorm(n1,mean=-122.40555,sd=dev))
#datetime
start<-as.POSIXct(strptime("2014/01/01", "%Y/%m/%d"))
end<-as.POSIXct(strptime("2014/02/28", "%Y/%m/%d"))
dt<-end-start
dd<-dt/2
h<-dd/24
t<-c(st... | #South SF, 6h, 12h and 18h clusters, #400000
#location
n1<-400
multiplier<-1
dev<-0.03
x<-c(rnorm(n1,mean=37.65338,sd=dev))
y<-c(rnorm(n1,mean=-122.40555,sd=dev))
#datetime
start<-as.POSIXct(strptime("2014/01/01", "%Y/%m/%d"))
end<-as.POSIXct(strptime("2014/02/28", "%Y/%m/%d"))
dt=end-start
dd<-dt/2
t<-c(start+rnorm(... | apache-2.0 | R |
6a675850e325c4e509804f93c2ab6b973f78e3d7 | update plotSTR | DrewWham/Genetic-Structure-Tools | plotSTR.r | plotSTR.r | library(stringr)
library(ggplot2)
library(data.table)
#function for extracting the cluster Probs, requires STR infile because STRUCTURE likes to chop off the ends of your sample names so I have to use your original file to get your original names
read.STR<-function(STR.in,STR.out){
#read in data
str<-read.table(STR.in... | library(stringr)
library(ggplot2)
library(data.table)
#function for extracting the cluster Probs, requires STR infile because STRUCTURE likes to chop off the ends of your sample names so I have to use your original file to get your original names
read.STR<-function(STR.in,STR.out){
#read in data
str<-read.table(STR.in... | apache-2.0 | R |
b326699eb813ac56171ff334fc04fe206b2c6c54 | Fix bug with data frame name | mattm/active-user-cohort-analysis | active-users.r | active-users.r | CSV_PATH = "data/test-data.csv"
CSV_SEPARATOR = "\t"
Run <- function() {
activities <- LoadActivityData()
data <- AnalyzeActiveUserCohorts(activities)
PlotActiveUserCohorts(data)
}
LoadActivityData <- function() {
activities <- read.csv(CSV_PATH, sep = CSV_SEPARATOR,
col.names = c("user.id", "date"), header = F... | CSV_PATH = "data/test-data.csv"
CSV_SEPARATOR = "\t"
Run <- function() {
activities <- LoadActivityData()
data <- AnalyzeActiveUserCohorts(activities)
PlotActiveUserCohorts(data)
}
LoadActivityData <- function() {
activities <- read.csv(CSV_PATH, sep = CSV_SEPARATOR,
col.names = c("user.id", "date"), header = F... | mit | R |
d7383e14d59de4c53a382f4f8dae4740dc49a4ec | Fix UI to match server. | IndyActuaries/epic-fhir,IndyActuaries/epic-fhir | ui.r | ui.r | #' ### CODE OWNERS: Shea Parkes, Kyle Baird
#'
#' ### OBJECTIVE:
#' * UI side of Epic FHIR Shiny App.
#'
#' ### DEVELOPER NOTES:
#' * None
require(shiny)
#' ### LIBRARIES, LOCATIONS, LITERALS, ETC. GO ABOVE HERE
shinyUI(fluidPage(
titlePanel("Demonstrating the value of INPC"),
sidebarLayout(
side... | #' ### CODE OWNERS: Shea Parkes, Kyle Baird
#'
#' ### OBJECTIVE:
#' * UI side of Epic FHIR Shiny App.
#'
#' ### DEVELOPER NOTES:
#' * None
require(shiny)
#' ### LIBRARIES, LOCATIONS, LITERALS, ETC. GO ABOVE HERE
shinyUI(fluidPage(
titlePanel("Demonstrating the value of INPC"),
sidebarLayout(
side... | mit | R |
53dc6cff730bdee73b1e68417c97ff5d531f594a | Fix mantel describe output | e3bo/2015pedv,e3bo/2015pedv,e3bo/2015pedv,e3bo/2015pedv | src/mantel-testing.r | src/mantel-testing.r | #!/usr/bin/Rscript
library(sds)
library(Hmisc)
library(pander)
library(plyr)
library(reshape2)
#' Create distance matrices
unwanted <- c('week', 'totalNumberSwineAccessions', 'Unk')
ind <- which(!colnames(real.case.data) %in% unwanted)
observed <- real.case.data[, ind]
CheckCrossCorLagSensitivity <- function(observ... | #!/usr/bin/Rscript
library(sds)
library(Hmisc)
library(pander)
library(plyr)
library(reshape2)
#' Create distance matrices
unwanted <- c('week', 'totalNumberSwineAccessions', 'Unk')
ind <- which(!colnames(real.case.data) %in% unwanted)
observed <- real.case.data[, ind]
CheckCrossCorLagSensitivity <- function(observ... | mit | R |
717cc7f7bec015e10edf630aef0187343510659b | Fix 02_lazy | snoweye/pbdMPI,snoweye/pbdMPI,snoweye/pbdMPI | inst/examples/test_send_recv/02_lazy.r | inst/examples/test_send_recv/02_lazy.r | ### SHELL> mpiexec -np 4 Rscript --vanilla [...].r
suppressMessages(library(pbdMPI, quietly = TRUE))
init()
.comm.size <- comm.size()
.comm.rank <- comm.rank()
N <- 5
x <- (1:N) + N * .comm.rank
if(.comm.rank == 0){
send(list(x))
} else if(.comm.rank == 1){
y <- recv()
}
comm.print(y, rank.print = 1)
if(.comm.r... | ### SHELL> mpiexec -np 4 Rscript --vanilla [...].r
suppressMessages(library(pbdMPI, quietly = TRUE))
init()
.comm.size <- comm.size()
.comm.rank <- comm.rank()
N <- 5
x <- (1:N) + N * .comm.rank
if(.comm.rank == 0){
send(list(x))
} else if(.comm.rank == 1){
y <- recv()
}
comm.print(y, rank.print = 1)
if(.comm.r... | mpl-2.0 | R |
905c92a3e220fe0a7bb29fdd71508c2308a54926 | Print total for sample in sig tests | charlieegan3/standpoint,charlieegan3/points-extraction,charlieegan3/standpoint,charlieegan3/standpoint,charlieegan3/points-extraction,charlieegan3/standpoint,charlieegan3/points-extraction,charlieegan3/standpoint,charlieegan3/points-extraction,charlieegan3/points-extraction,charlieegan3/points-extraction | evaluation/r_analysis/sig_tests.r | evaluation/r_analysis/sig_tests.r | library(scales)
study1 = read.csv(file="study1.csv", header=TRUE, sep=",")
study2 = read.csv(file="study2.csv", header=TRUE, sep=",")
study2_extracts = read.csv(file="study2_extracts.csv", header=TRUE, sep=",")
successesFailures <- function(table, comparison, factor) {
print(sprintf("total: %i",sum(table[table$comp... | library(scales)
study1 = read.csv(file="study1.csv", header=TRUE, sep=",")
study2 = read.csv(file="study2.csv", header=TRUE, sep=",")
study2_extracts = read.csv(file="study2_extracts.csv", header=TRUE, sep=",")
successesFailures <- function(table, comparison, factor) {
counts = table[table$comparison==comparison & ... | mit | R |
a04290bef08857c229ed242321d20f706990975b | change formula to calculate "new function commit" | koji-to/effort_calculator,koji-to/effort_calculator,koji-to/effort_calculator | calculate_metrics.r | calculate_metrics.r | #extract commit log from each relase cycle
##### setting section #####
release_cycle<-42#days(= 6 weeks = 1.5month)
threshold<-2#commits/release_cycle
newest_relase_date<-as.Date("2014-06-20")#ver37
num_release<-8#: a number of past release to trace
##### processing section #####
# import merged git log file
git_log.... | #extract commit log from each relase cycle
##### setting section #####
release_cycle<-42#days(= 6 weeks = 1.5month)
threshold<-2#commits/release_cycle
newest_relase_date<-as.Date("2014-06-20")#ver37
num_release<-8#: a number of past release to trace
##### processing section #####
# import merged git log file
git_log.... | mit | R |
a56991ad17b3140a9922d7cb1a290c51d7522627 | add googlesheets4 | berkeley-dsep-infra/datahub,ryanlovett/datahub,ryanlovett/datahub,ryanlovett/datahub,berkeley-dsep-infra/datahub,berkeley-dsep-infra/datahub | deployments/r/image/extras.d/ph-142.r | deployments/r/image/extras.d/ph-142.r | #!/usr/bin/env Rscript
# From https://github.com/berkeley-dsep-infra/datahub/issues/881
print("Installing packages for PH142")
print("Installing fGarch...")
devtools::install_github('cran/fGarch', ref='3042.83.1', upgrade_dependencies=FALSE, quiet=TRUE)
print("Installing SASxport...")
devtools::install_github('cran/S... | #!/usr/bin/env Rscript
# From https://github.com/berkeley-dsep-infra/datahub/issues/881
print("Installing packages for PH142")
print("Installing fGarch...")
devtools::install_github('cran/fGarch', ref='3042.83.1', upgrade_dependencies=FALSE, quiet=TRUE)
print("Installing SASxport...")
devtools::install_github('cran/S... | bsd-3-clause | R |
3c15d72a6b4bde83a7f73d7c5b3e02807d14a9d1 | Install bettertrace on startup if not present. | syberia/syberia | R/zzz.r | R/zzz.r | .onAttach <- function(...) {
if (!isTRUE(getOption("syberia.silent"))) {
packageStartupMessage(paste0("Loading ", crayon::red("Syberia"), "...\n"))
}
# Load better trace.
if (isTRUE(getOption("syberia.autoload_bettertrace", TRUE))) {
if (!is.element("devtools", utils::installed.packages()[, 1])) {
... | .onAttach <- function(...) {
if (!isTRUE(getOption("syberia.silent"))) {
packageStartupMessage(paste0("Loading ", crayon::red("Syberia"), "...\n"))
}
# We want to initialize a Syberia project in the current working directory
# because 9 times out of 10 this is what the user wants.
#
# However, this h... | mit | R |
3aae50e6f4567cf3ad914eb27df4963b9beffd2d | Remove counties that were only measured in 2008 | hadley/sfhousing,hadley/sfhousing,hadley/sfhousing | explore-summary.r | explore-summary.r | library(ggplot2)
source("date.r")
source("explore-data.r")
theme_set(theme_bw())
source("finances.r")
# Control for inflation ------------------------------------------------------
geo$month <- month(geo$date)
geo$year <- year(geo$date)
geo <- merge(geo, cpi, by = c("month", "year"), sort = F)
geo$priceadj <- geo$p... | library(ggplot2)
source("date.r")
source("explore-data.r")
theme_set(theme_bw())
source("finances.r")
# Control for inflation ------------------------------------------------------
geo$month <- month(geo$date)
geo$year <- year(geo$date)
geo <- merge(geo, cpi, by = c("month", "year"), sort = F)
geo$priceadj <- geo$p... | mit | R |
549292dd46e0b830e081dcc36f56ef14239dfab2 | Set font for geom_text/geom_label | klmr/ggplots | __init__.r | __init__.r | #' Pretty plotting module
export = import('./export', attach = 'export_from')
gg = import_package('ggplot2')
export_from(gg)
#
# Set a very minimal theme. Avoid chartjunk.
#
fonts = import('./fonts')
fonts$register_font('Roboto')
fonts$register_font('Roboto Condensed', 'RobotoCondensed')
theme_set(theme_minimal() ... | #' Pretty plotting module
export = import('./export', attach = 'export_from')
gg = import_package('ggplot2')
export_from(gg)
#
# Set a very minimal theme. Avoid chartjunk.
#
fonts = import('./fonts')
fonts$register_font('Roboto')
fonts$register_font('Roboto Condensed', 'RobotoCondensed')
theme_set(theme_minimal() ... | apache-2.0 | R |
d24aa25545e17a41c0fe7127071e8c0dc399eb04 | Read .Rprofile when dispatching to R | klmr/modules,klmr/modules | tests/testthat/helper-callr.r | tests/testthat/helper-callr.r | rcmd = function (script_path) {
cmd = 'R CMD BATCH --slave --no-restore --no-save --no-timing'
output_file = 'output.rout'
on.exit(unlink(output_file))
system(paste(cmd, script_path, output_file))
readLines(output_file)
}
rscript = function (script_path) {
cmd = 'Rscript --slave --no-restore --... | rcmd = function (script_path) {
cmd = 'R CMD BATCH --slave --vanilla --no-restore --no-save --no-timing'
output_file = 'output.rout'
on.exit(unlink(output_file))
system(paste(cmd, script_path, output_file))
readLines(output_file)
}
rscript = function (script_path) {
cmd = 'Rscript --slave --van... | apache-2.0 | R |
950cd7c0ab6e8f2a81460214672fcffda42dc005 | Fix sbatch_opts_insert bug | jmousseau/Stain | R/sbatch.r | R/sbatch.r | #' Create an SBATCH option
#'
#' @param key The key for the sbatch option.
#'
#' @return A function that takes a single argument representing
#' the value for the \code{key}.
sbatch_opt <- function(key) {
return(function(value) {
return(paste0("--", key, "=", value))
})
}
#' Test sbatch options for eq... | #' Create an SBATCH option
#'
#' @param key The key for the sbatch option.
#'
#' @return A function that takes a single argument representing
#' the value for the \code{key}.
sbatch_opt <- function(key) {
return(function(value) {
return(paste0("--", key, "=", value))
})
}
#' Test sbatch options for eq... | mit | R |
c9fe316c71c413e8a94604c51abe4dd28ef4b3a7 | Update LogParser.r | bgweber/RServer,bgweber/RServer,bgweber/RServer,bgweber/RServer | tasks/RServerTasks/LogParser.r | tasks/RServerTasks/LogParser.r |
path <- "/var/www/html/RServer/logs"
if (Sys.info()['sysname'] == "Windows") {
path <- "C:/wamp/www/RServer/logs"
}
if ("DT" %in% rownames(installed.packages()) == FALSE) {
install.packages("DT", repos='http://cran.us.r-project.org')
}
library(DT)
loadTaskData <- function(daysHistory = 60) {
events <- da... |
if ("DT" %in% rownames(installed.packages()) == FALSE) {
install.packages("DT", repos='http://cran.us.r-project.org')
}
library(DT)
loadTaskData <- function(daysHistory = 60) {
events <- data.frame()
for (file in list.files("C:/wamp/www/RServer/logs", full.names = TRUE)) {
date <- as.Date(strspli... | bsd-3-clause | R |
553362a506b094a3a258bb7b32b160e33cc81132 | Save the data to a CSV | petercarrjones/icc-data,petercarrjones/icc-data,petercarrjones/icc-data | load.r | load.r | #Load Packages
library(XML)
library(tidyr)
library(stringr)
library(magrittr)
library(dplyr)
library(RWeka)
#load OCR'd ICC Deceisions data into R
icc_dir <- "text"
files <- dir(icc_dir, "*.txt")
raw <- file.path(icc_dir, files) %>%
lapply(., scan, "character", sep = "\n")
names(raw) <- files
icc_texts <- lapply(ra... | #Load Packages
library(XML)
library(tidyr)
library(stringr)
library(magrittr)
library(dplyr)
library(RWeka)
#load OCR'd ICC Deceisions data into R
icc_dir <- "text"
files <- dir(icc_dir, "*.txt")
raw <- file.path(icc_dir, files) %>%
lapply(., scan, "character", sep = "\n")
names(raw) <- files
icc_texts <- lapply(ra... | mit | R |
616e9692c423a866083773dd6491ef4cd192064c | fix error in print-test.r | red-eco/red,NikolayShubenkovProgSchool/red,rheber/red,vehar/red,vehar/red,NikolayShubenkovProgSchool/red,rheber/red,red-eco/red | tests/source/compiler/print-test.r | tests/source/compiler/print-test.r | REBOL [
Title: "Red print test script"
Author: "Peter W A Wood"
File: %print-test.r
Tabs: 4
Rights: "Copyright (C) 2011-2012 Peter W A Wood. All rights reserved."
License: "BSD-3 - https://github.com/dockimbel/Red/blob/origin/BSD-3-License.txt"
]
~~~start-file~~~ "Red print"
--test-- "Red print 1"
... | REBOL [
Title: "Red print test script"
Author: "Peter W A Wood"
File: %print-test.r
Tabs: 4
Rights: "Copyright (C) 2011-2012 Peter W A Wood. All rights reserved."
License: "BSD-3 - https://github.com/dockimbel/Red/blob/origin/BSD-3-License.txt"
]
~~~start-file~~~ "Red print"
--test-- "Red print 1"
... | bsd-3-clause | R |
fe67c5d7cfc4ec55e95ae2955f3be37fb3d844e7 | Adjust R importing to be relative. | IndyActuaries/epic-fhir,IndyActuaries/epic-fhir | r/load_data.r | r/load_data.r | #' ## Code Owners: Kyle Baird, Shea Parkes
#'
#' ### Objective:
#' * Load the data for analytics into native R data structures so it is easy to work with
#'
#' ### Developer Notes:
#' * <none>
path.dir.source <- '../data/'
#' ## LIBRARIES, LOCATIONS, LITERALS, ETC. GO ABOVE HERE
df.labs <- read.csv(
paste0(p... | #' ## Code Owners: Kyle Baird
#' ### OWNERS ATTEST TO THE FOLLOWING:
#' * The `master` branch will meet Milliman QRM standards at all times.
#' * Deliveries will only be made from code in the `master` branch.
#' * Review/Collaboration notes will be captured in Pull Requests (prior to merging).
#'
#'
#' ### Obje... | mit | R |
422d160bfd10bfc09a84dc1e37beb88f3082e40f | read data from rds folder | isezen/sahra,isezen/sahra | code/calcor.r | code/calcor.r | # Saharan Dust Transport Research
# 2016-05-04 Ismail SEZEN
# sezenismail@gmail.com
source("code/correlation.r")
source("code/filehelper.r")
calcor <- function(files = stop("'file' must be specified")) {
pm <- read_pm10()
dir_out <- "data/cor"
dir.create(dir_out, showWarnings = F)
nof <- length(files)
i <- ... | # Saharan Dust Transport Research
# 2016-05-04 Ismail SEZEN
# sezenismail@gmail.com
source("code/correlation.r")
source("code/filehelper.r")
calcor <- function(files = stop("'file' must be specified")) {
pm <- read_pm10()
dir_out <- "data/cor"
dir.create(dir_out, showWarnings = F)
nof <- length(files)
i <- ... | mit | R |
251f187a1aabe382153c45b841b1d33757722e19 | Update README.rd | grndlvl/dstack,grndlvl/dstack,grndlvl/dstack,GollyGood/dstack,GollyGood/dstack,GollyGood/dstack,grndlvl/dstack,grndlvl/dstack,GollyGood/dstack,GollyGood/dstack | assets/ssl/README.rd | assets/ssl/README.rd | # Creating a self signed certificate
*NOTE: the keys provided are NOT secure as it is the same for all released versions of dStack.*
1) Run the following command replacing [mydomain] for that fully qualified domain
name of the site you wish to create a new certificate for. This will create a key
and a cert(cert... | # Creating a self signed certificate
**NOTE: the keys provided are NOT secure as it is the same for all released versions of dStack.**
1) Run the following command replacing [mydomain] for that fully qualified domain
name of the site you wish to create a new certificate for. This will create a key
and a cert(ce... | apache-2.0 | R |
35205d823d5e2e6148a81e0b33cb74d4e6e68683 | Add annual statistics | GreatEmerald/geoscripting,GreatEmerald/geoscripting,GreatEmerald/geoscripting,GreatEmerald/geoscripting | Project/main.r | Project/main.r | # Team Rython: Dainius Masiliunas and Tim Weerman
# Date: January 2016
# License: Apache License 2.0
library(bfastSpatial)
filelist = read.csv("data/data_url_script_2016-01-15_032836.txt")
filename = "data/MCD15A2H.A2015201.h19v03.006.2015304024904.hdf"
# Magic numbers!
filtermask = 0x8C # Filter out dead detectors, ... | # Team Rython: Dainius Masiliunas and Tim Weerman
# Date: January 2016
# License: Apache License 2.0
library(bfastSpatial)
filelist = read.csv("data/data_url_script_2016-01-15_032836.txt")
filename = "data/MCD15A2H.A2002193.h19v03.006.2015149105839.hdf"
# Magic numbers!
filtermask = 0x8C # Filter out dead detectors, ... | apache-2.0 | R |
a2ae5226b9de61ae3678571142d343a08f10ed46 | update dataset location to rawgit | ruettet/citetaal | code.r | code.r | # stuff that you need to install/load
library(sp)
library(maptools)
library(spdep)
library(RANN)
library(maps)
library(mapdata)
library(xtable)
## some functions that are needed for non-us maps
loadGADM <- function (fileName, level = 0, ...) {
print(paste("./", fileName, "_adm", level, ".RData", sep = ""))
load(past... | # stuff that you need to install/load
library(sp)
library(maptools)
library(spdep)
library(RANN)
library(maps)
library(mapdata)
library(xtable)
## some functions that are needed for non-us maps
loadGADM <- function (fileName, level = 0, ...) {
print(paste("./", fileName, "_adm", level, ".RData", sep = ""))
load(past... | apache-2.0 | R |
679f0f0598a02398712065235bd608dd1a19a7ef | Remove the redundant "/payload" parsing | kealist/ren-c,draegtun/ren-c,codebybrett/ren-c,kealist/ren-c,hostilefork/rebol,giuliolunati/ren-c,kealist/ren-c,draegtun/ren-c,mbk/ren-c,rgchris/ren-c,draegtun/ren-c,mbk/ren-c,giuliolunati/ren-c,codebybrett/ren-c,hostilefork/rebol,kealist/ren-c,hostilefork/rebol,codebybrett/ren-c,codebybrett/ren-c,giuliolunati/ren-c,dr... | make/encap.r | make/encap.r | REBOL[]
args: parse system/script/args ""
exe: none
payload: none
output: none
as-is: false ;don't compress, in case people try to avoid decompression to speed up bootup
windows?: 3 = fourth system/version
while [not tail? args] [
arg: first args
case [
any [arg = "/rebol"
arg = "/r"] [
exe: second ar... | REBOL[]
args: parse system/script/args ""
exe: none
payload: none
output: none
as-is: false ;don't compress, in case people try to avoid decompression to speed up bootup
windows?: 3 = fourth system/version
while [not tail? args] [
arg: first args
case [
any [arg = "/rebol"
arg = "/r"] [
exe: second ar... | apache-2.0 | R |
371b4b250a8331e3c9aed3ce2a03a0bea67cc80e | Simplify table function | klmr/modules,klmr/modules | vignettes/utils/seq.r | vignettes/utils/seq.r | #' Test whether input is valid biological sequence
#' @param seq a character vector or \code{seq} object
valid_seq = function (seq)
UseMethod('valid_seq')
valid_seq.default = function (seq) {
valid = function (x)
! any(is.na(match(strsplit(x, '')[[1]], c('A', 'C', 'G', 'T'))))
all(vapply(toupper(se... | #' Test whether input is valid biological sequence
#' @param seq a character vector or \code{seq} object
valid_seq = function (seq)
UseMethod('valid_seq')
valid_seq.default = function (seq) {
valid = function (x)
! any(is.na(match(strsplit(x, '')[[1]], c('A', 'C', 'G', 'T'))))
all(vapply(toupper(se... | apache-2.0 | R |
914933ef52429fe8cdd7e4122905ff434dd36184 | Update onLoad.r | alfcrisci/rBiometeo,alfcrisci/rBiometeo | R/onLoad.r | R/onLoad.r | #' @importFrom V8 new_context
ct <- NULL
.onLoad <- function(libname, pkgname){
ct <- V8::new_context()
ct$source(system.file("js/biometeo.js", package = pkgname))
}
| #' .onLoad
#'
#' @importFrom V8 new_context
ct <- NULL
.onLoad <- function(libname, pkgname){
ct <- V8::new_context()
ct$source(system.file("js/biometeo.js", package = pkgname))
}
| mit | R |
e18e3836789a6bdcb6b023eb418a95bcc9a8b416 | Update the banner as requested by David | zsx/r3,zsx/r3,zsx/r3,zsx/r3 | src/mezz/mezz-banner.r | src/mezz/mezz-banner.r | REBOL [
System: "REBOL [R3] Language Interpreter and Run-time Environment"
Title: "REBOL 3 Mezzanine: Startup Banner"
Rights: {
Copyright 2012 REBOL Technologies
REBOL is a trademark of REBOL Technologies
}
License: {
Licensed under the Apache License, Version 2.0
See: http://www.apache.org/licenses/LICENS... | REBOL [
System: "REBOL [R3] Language Interpreter and Run-time Environment"
Title: "REBOL 3 Mezzanine: Startup Banner"
Rights: {
Copyright 2012 REBOL Technologies
REBOL is a trademark of REBOL Technologies
}
License: {
Licensed under the Apache License, Version 2.0
See: http://www.apache.org/licenses/LICENS... | apache-2.0 | R |
6181f3aedd2e77251f1ad8b94fd18106c2012e28 | Update analiza.r | aleksandrov2/APPR-2015-16 | analiza/analiza.r | analiza/analiza.r | # 4. faza: Analiza podatkov
napoved <- lm(data = podatki3 %>% filter(Cas == 2006), Deficit ~ Dolg)
predict(napoved, data.frame(Dolg=seq(0, 250, 25)))
napoved2 <- lm(data = podatki3 %>% filter(Cas == 2014), Deficit ~ Dolg)
predict(napoved2, data.frame(Dolg=seq(0, 250, 25)))
#sedaj bi radi ločili države v skupine, g... | # 4. faza: Analiza podatkov
napoved <- lm(data = podatki3 %>% filter(Cas == 2006), Deficit ~ Dolg)
predict(napoved, data.frame(Dolg=seq(0, 250, 25)))
napoved2 <- lm(data = podatki3 %>% filter(Cas == 2014), Deficit ~ Dolg)
predict(napoved2, data.frame(Dolg=seq(0, 250, 25)))
#sedaj bi radi ločili države v skupine, g... | mit | R |
5c7cf211be6d58ca08266ff54bdcf14b7b4aac18 | update test | s-u/rgithub,akhmed1/rgithub,cscheid/rgithub,aronlindberg/rgithub | inst/tests/test_basic.r | inst/tests/test_basic.r | context("Basic Tests")
test_that("A basic rgithub context can be acquired", {
ctx <- create.github.context("https://api.github.com")
repos <- get.user.repositories("cscheid", ctx = ctx)
print(repos)
})
| context("Basic Tests")
test_that("A basic rgithub context can be acquired", {
ctx <- create.github.context("https://api.github.com")
repos <- get.user.repositories(ctx, "cscheid")
print(repos)
})
| mit | R |
8814a38a9bc88d733fd0ec2c747062ed40209262 | rename ggplot theme | infotroph/DeLuciatoR | ggthemes.r | ggthemes.r | theme_ggEHD = function(...){
(theme_bw() %+% theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.ticks.length = unit(-0.75, "lines"),
axis.ticks.margin = unit(1.5, "lines"),
text=element_text( # Can we inherit some of these?
family="",
face="plain",
size=18,
hjust=... | theme_delucia = function(...){
(theme_bw() %+% theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.ticks.length = unit(-0.75, "lines"),
axis.ticks.margin = unit(1.5, "lines"),
text=element_text( # Can we inherit some of these?
family="",
face="plain",
size=18,
hjus... | mit | R |
03fe20491b88c91ed0e47cb2a5e9e76aba3eaf05 | clean up | shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl | lib/scRNA/seurat_doublet_finder.r | lib/scRNA/seurat_doublet_finder.r |
library(Seurat)
library(DoubletFinder)
options(future.globals.maxSize= 10779361280)
random.seed=20200107
min.pct=0.5
logfc.threshold=0.6
options_table<-read.table(parSampleFile1, sep="\t", header=F, stringsAsFactors = F)
myoptions<-split(options_table$V1, options_table$V2)
by_sctransform<-ifelse(myoptions$by_sctran... |
source("scRNA_func.r")
library(dplyr)
library(Seurat)
library(ggplot2)
library(ggpubr)
library(DT)
library(data.table)
library(digest)
library(heatmap3)
library(cowplot)
library(scales)
library(stringr)
library(htmltools)
library(patchwork)
library(glmGamPoi)
library(DoubletFinder)
options(future.globals.maxSize= 107... | apache-2.0 | R |
d388960062ddedba9e18de5586344a47572369bd | Fix module name in help title | klmr/modules,klmr/modules | R/help.r | R/help.r | parse_documentation = function (module) {
module_path = module_path(module)
parsed = list(env = module,
blocks = roxygen2:::parse_file(module_path, module))
roclet = roxygen2:::rd_roclet()
rdfiles = roxygen2:::roc_process(roclet, parsed, dirname(module_path))
rdcontents = lapply(rd... | parse_documentation = function (module) {
module_path = module_path(module)
parsed = list(env = module,
blocks = roxygen2:::parse_file(module_path, module))
roclet = roxygen2:::rd_roclet()
rdfiles = roxygen2:::roc_process(roclet, parsed, dirname(module_path))
rdcontents = lapply(rd... | apache-2.0 | R |
380c58bab669b7a214f0d60a12fda32ab1ea5335 | fix t() for comply with test | mschubert/narray,mschubert/narray | mask.r | mask.r | .s = import('./stack')
#' Converts a list of character vectors to a logical matrix
#'
#' @param x A list of character vectors
#' @return A logical occurrence matrix
mask = function(x) {
if (is.factor(x))
x = as.character(x)
vectorList = lapply(x, function(xi) setNames(rep(TRUE, length(xi)), xi))
... | .s = import('./stack')
#' Converts a list of character vectors to a logical matrix
#'
#' @param x A list of character vectors
#' @return A logical occurrence matrix
mask = function(x) {
if (is.factor(x))
x = as.character(x)
vectorList = lapply(x, function(xi) setNames(rep(TRUE, length(xi)), xi))
... | apache-2.0 | R |
98fd024e994854add6ee7a43670b0c95947e31a4 | Load Rdata files into the Global environment | jmousseau/Stain | R/slurm-bash-script.r | R/slurm-bash-script.r | #' SlurmBashScript R6 object.
#'
#' Generates the necessary bash script to submit through
#' the `sbatch` command.
SlurmBashScript <- R6::R6Class("SlurmBashScript",
public = list(
initialize = function(container, main_file, copy_back = c("*")) {
private$cat_main_file_magic(container$dir, main_fi... | #' SlurmBashScript R6 object.
#'
#' Generates the necessary bash script to submit through
#' the `sbatch` command.
SlurmBashScript <- R6::R6Class("SlurmBashScript",
public = list(
initialize = function(container, main_file, copy_back = c("*")) {
private$cat_main_file_magic(container$dir, main_fi... | mit | R |
c7dd5810c3839e8a1d5efde20b7df8b3cf3f633f | Update 2012_PR_config.r | PSC-CoTC/PSC-FRAM-Admin,PSC-CoTC/PSC-FRAM-Admin | config/2012_PR_config.r | config/2012_PR_config.r | #note: here "pre.season" means "original BK post-season" for the Periodic Report comparison tables
run.year <- 2012
post.season.fram.db <- "./fram db/PeriodicReportdb/FramVS2-PSC-Coho-Backwards-redo 2010-2016 January 2019 products.mdb"
post.season.run.name <- "bc-bkCoho2012 step 2"
post.season.tamm <- "./fram db/Perio... |
run.year <- 2012
post.season.fram.db <- "./fram db/PeriodicReportdb/FramVS2-PSC-Coho-Backwards-redo 2010-2016 January 2019 products.mdb"
post.season.run.name <- "bc-bkCoho2012 step 2"
post.season.tamm <- "./fram db/PeriodicReportdb/updated2010-2016TAMMfiles/BK 2012 January 2019 redo.xlsm"
post.season.tamm.fishery.ref... | mit | R |
4f2cea838c3502100e59318b0a6c53a8cd1c35ac | Update aggr-nodes.r | SwedishPensionsAgency/Hierarchy | R/aggr-nodes.r | R/aggr-nodes.r | #' Aggregate by
#'
#' A wrapper function to the path enumeration class to aggregate nodes.
#' The hierarchical data set must have a path enumerated column.
#'
#' @param data data frame
#' @param path column with path enumeration ids
#' @param metrics metric columns
#' @param ids node id (e.g. "1.2.1.3")
#' @param by ... | #' Aggregate by
#'
#' A wrapper function to the path enumeration class to aggregate nodes.
#' The hierarchical data set must have a path enumerated column.
#'
#' @param data data frame
#' @param path column with path enumeration ids
#' @param metrics metric columns
#' @param ids node id (e.g. "1.2.1.3")
#' @param by ... | agpl-3.0 | R |
84821b3ff15bffba68157e501256967353fb29ee | Make plot more readable. | BitFunnel/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel | src/Scripts/plot-correlations.r | src/Scripts/plot-correlations.r | # Takes input from correlation-histogram.py
library("ggplot2")
setwd("~/dev/BitFunnel/src/Scripts")
png(filename="term-term.png",width=1600,height=1200)
# df <- read.csv(header=FALSE, file="wat.csv")
term_term <- read.csv(header=TRUE, file="/tmp/term-term.csv")
ggplot(data=term_term, aes(x=bucket, y=count, fill=trea... | # Takes input from correlation-histogram.py
library("ggplot2")
setwd("~/dev/BitFunnel/src/Scripts")
png(filename="term-term.png",width=1600,height=1200)
# df <- read.csv(header=FALSE, file="wat.csv")
term_term <- read.csv(header=TRUE, file="/tmp/term-term.csv")
ggplot(data=term_term, aes(x=bucket, y=count, fill=trea... | mit | R |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.