content
large_stringlengths
0
6.46M
path
large_stringlengths
3
331
license_type
large_stringclasses
2 values
repo_name
large_stringlengths
5
125
language
large_stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
4
6.46M
extension
large_stringclasses
75 values
text
stringlengths
0
6.46M
context("test-shapley.R") RNGversion(vstr = "3.5.0") test_that("Basic test functions in shapley.R", { # Load data ----------- if (requireNamespace("MASS", quietly = TRUE)) { data("Boston", package = "MASS") x_var <- c("lstat", "rm", "dis", "indus") x_train <- tail(Boston[, x_var], 50) # Load pre...
/tests/testthat/test-a-shapley.R
permissive
stjordanis/shapr
R
false
false
8,013
r
context("test-shapley.R") RNGversion(vstr = "3.5.0") test_that("Basic test functions in shapley.R", { # Load data ----------- if (requireNamespace("MASS", quietly = TRUE)) { data("Boston", package = "MASS") x_var <- c("lstat", "rm", "dis", "indus") x_train <- tail(Boston[, x_var], 50) # Load pre...
#### Получение информации о пользователе сети ВКонтакте. library(RCurl) library(rjson) # Параметры доступа access_token <- "ключ_доступа_вашего_приложения" ver <- "5.53" # Идентификатор пользователя uid <- "идентификатор_пользователя" # Функция запроса к API vk <- function( method, params ) { if( !missing(param...
/Сбор данных в интернете/18/02-user_info.R
no_license
kn7072/R
R
false
false
1,599
r
#### Получение информации о пользователе сети ВКонтакте. library(RCurl) library(rjson) # Параметры доступа access_token <- "ключ_доступа_вашего_приложения" ver <- "5.53" # Идентификатор пользователя uid <- "идентификатор_пользователя" # Функция запроса к API vk <- function( method, params ) { if( !missing(param...
############## data preparing for Brandon install.packages("sqldf") library(sqldf) s01 <- sqldf("select pdbid, chainid from protein_annotate_onlysnp group by UniProtID") write.table(s01, file = "unique_pdb.txt", quote = F, row.names = F) # get uniprot with disease snp in binding site uniprot_bs_ds <- sqldf('select Un...
/Analysis/brandon.R
permissive
ajing/SIFTS.py
R
false
false
2,464
r
############## data preparing for Brandon install.packages("sqldf") library(sqldf) s01 <- sqldf("select pdbid, chainid from protein_annotate_onlysnp group by UniProtID") write.table(s01, file = "unique_pdb.txt", quote = F, row.names = F) # get uniprot with disease snp in binding site uniprot_bs_ds <- sqldf('select Un...
library(ape) testtree <- read.tree("1177_2.txt") unrooted_tr <- unroot(testtree) write.tree(unrooted_tr, file="1177_2_unrooted.txt")
/codeml_files/newick_trees_processed/1177_2/rinput.R
no_license
DaniBoo/cyanobacteria_project
R
false
false
135
r
library(ape) testtree <- read.tree("1177_2.txt") unrooted_tr <- unroot(testtree) write.tree(unrooted_tr, file="1177_2_unrooted.txt")
library(ape) testtree <- read.tree("7705_0.txt") unrooted_tr <- unroot(testtree) write.tree(unrooted_tr, file="7705_0_unrooted.txt")
/codeml_files/newick_trees_processed/7705_0/rinput.R
no_license
DaniBoo/cyanobacteria_project
R
false
false
135
r
library(ape) testtree <- read.tree("7705_0.txt") unrooted_tr <- unroot(testtree) write.tree(unrooted_tr, file="7705_0_unrooted.txt")
rm(list=ls()) library(dplyr) library(tidyr) library(ggplot2) library(testthat) library(bbmle) library(lme4) library(readxl) options(stringsAsFactors = F) source("analysis/format_data/format_scripts.R") source("analysis/format_data/format_functions.R") # data lupine_df <- read.csv( "data/lupine_all.csv") enso ...
/analysis/vital_rates/crossvalidation/fert_cv_t0.R
no_license
AldoCompagnoni/lupine
R
false
false
8,895
r
rm(list=ls()) library(dplyr) library(tidyr) library(ggplot2) library(testthat) library(bbmle) library(lme4) library(readxl) options(stringsAsFactors = F) source("analysis/format_data/format_scripts.R") source("analysis/format_data/format_functions.R") # data lupine_df <- read.csv( "data/lupine_all.csv") enso ...
source("utility.R") require(Hmisc) # for inc function TrainMarkov <- function(text, lookup) { ## Creates the transition probability matrix, T[i,j] is the number ## of times word j follows word i. No need to standardize since ## all functions that use T will implicity standardize N <- length(lookup) ...
/markov.R
no_license
tpospisi/RObama
R
false
false
798
r
source("utility.R") require(Hmisc) # for inc function TrainMarkov <- function(text, lookup) { ## Creates the transition probability matrix, T[i,j] is the number ## of times word j follows word i. No need to standardize since ## all functions that use T will implicity standardize N <- length(lookup) ...
##################################################################### # Directory : # Program Name: OLS_specification.R # Analyst : Paul Laskowski # Last Updated: 4/3/2015 # # Purpose: # OLS Specification ##################################################################### #####################################...
/Async/Week 13/OLS_specification.R
no_license
shanbrianhe/W203-Statistics-for-Data-Science
R
false
false
6,725
r
##################################################################### # Directory : # Program Name: OLS_specification.R # Analyst : Paul Laskowski # Last Updated: 4/3/2015 # # Purpose: # OLS Specification ##################################################################### #####################################...
library(ggplot2) library(gridExtra) #arrangeGrob this_base <- "fig07-02_annual-report-aspect-ratio-2" my_data <- data.frame( income = c(117187, 202796, 357284, 392216, 163811), year = c(1999, 2000, 2001, 2002, 2003)) p <- ggplot(my_data, aes(x = year, y = income / 1000)) + geom_line() + geom_point(shape = 21...
/B_analysts_sources_github/jennybc/r-graph-catalog/fig07-02_annual-report-aspect-ratio-2.R
no_license
Irbis3/crantasticScrapper
R
false
false
1,383
r
library(ggplot2) library(gridExtra) #arrangeGrob this_base <- "fig07-02_annual-report-aspect-ratio-2" my_data <- data.frame( income = c(117187, 202796, 357284, 392216, 163811), year = c(1999, 2000, 2001, 2002, 2003)) p <- ggplot(my_data, aes(x = year, y = income / 1000)) + geom_line() + geom_point(shape = 21...
source("common.R") #' plot2 is just a simple line graph of 'Global_active_power' over time with some extra #' formatting. #' #' @param ylab the label to use on the y-axis. Defaults to the one needed for plot2 in the #' assignment but can be overriden for plot4 which is slightly different. #' @references `p...
/plot2.R
no_license
jasoma/ExData_Plotting1
R
false
false
682
r
source("common.R") #' plot2 is just a simple line graph of 'Global_active_power' over time with some extra #' formatting. #' #' @param ylab the label to use on the y-axis. Defaults to the one needed for plot2 in the #' assignment but can be overriden for plot4 which is slightly different. #' @references `p...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/consume.R \name{consume} \alias{consume} \title{Use a web service to score data in list (key=value) format.} \usage{ consume(endpoint, ..., globalParam, retryDelay = 10, output = "output1", .retry = 5) } \arguments{ \item{endpoint}{Either a...
/man/consume.Rd
no_license
Vijayreddym/AzureML
R
false
true
10,201
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/consume.R \name{consume} \alias{consume} \title{Use a web service to score data in list (key=value) format.} \usage{ consume(endpoint, ..., globalParam, retryDelay = 10, output = "output1", .retry = 5) } \arguments{ \item{endpoint}{Either a...
source("global.R") dashboardPage( skin = "red", dashboardHeader(title = "R-Lab / Milano Budget Trasparente", titleWidth = 450), dashboardSidebar(disable = TRUE), dashboardBody( navbarPage("Schede", tabPanel("Ripartizione fondi per missione", sidebarPanel( ...
/app/ui.R
no_license
r-lab-milano/r-lab3-shinyMilano
R
false
false
5,326
r
source("global.R") dashboardPage( skin = "red", dashboardHeader(title = "R-Lab / Milano Budget Trasparente", titleWidth = 450), dashboardSidebar(disable = TRUE), dashboardBody( navbarPage("Schede", tabPanel("Ripartizione fondi per missione", sidebarPanel( ...
MAD(mean(BMI ~ diet, data = Diets1)) Diets1.null <- do(1000) * MAD(mean(shuffle(BMI) ~ diet, data = Diets1)) head(Diets1.null, 3) dotPlot(~ result, data = Diets1.null, n = 50, groups = (result >= 0.747)) prop(~ (result >= 0.747), data = Diets1.null)
/inst/snippets/Exploration9.2.6.R
no_license
rpruim/ISIwithR
R
false
false
251
r
MAD(mean(BMI ~ diet, data = Diets1)) Diets1.null <- do(1000) * MAD(mean(shuffle(BMI) ~ diet, data = Diets1)) head(Diets1.null, 3) dotPlot(~ result, data = Diets1.null, n = 50, groups = (result >= 0.747)) prop(~ (result >= 0.747), data = Diets1.null)
testlist <- list(bytes1 = integer(0), pmutation = 4.94065645841247e-323) result <- do.call(mcga:::ByteCodeMutation,testlist) str(result)
/mcga/inst/testfiles/ByteCodeMutation/libFuzzer_ByteCodeMutation/ByteCodeMutation_valgrind_files/1612886893-test.R
no_license
akhikolla/updatedatatype-list3
R
false
false
136
r
testlist <- list(bytes1 = integer(0), pmutation = 4.94065645841247e-323) result <- do.call(mcga:::ByteCodeMutation,testlist) str(result)
## Forest plot from odds/hazard ratios. # xlabs = labels for the x axis (coordinates are flipped here so x is the vertical axis) # title = plot title # breaks = breaks in the y axis (correspond to spacing of the elements on the plot) make_forest <- function (dataframe, xlabs, title, breaks) { ymax <- max(dat...
/functions.R
no_license
zuz-bien/covid_aki
R
false
false
5,775
r
## Forest plot from odds/hazard ratios. # xlabs = labels for the x axis (coordinates are flipped here so x is the vertical axis) # title = plot title # breaks = breaks in the y axis (correspond to spacing of the elements on the plot) make_forest <- function (dataframe, xlabs, title, breaks) { ymax <- max(dat...
\name{Bisect} \alias{Bisect} %- Also NEED an '\alias' for EACH other topic documented here. \title{ An implementation of the bisection algorithm for root finding } \description{ Most of the optimization is \code{Icens} have a one dimensional root-finding component. Since the quantities involved are generally restricted...
/man/Bisect.Rd
no_license
cran/glrt
R
false
false
1,559
rd
\name{Bisect} \alias{Bisect} %- Also NEED an '\alias' for EACH other topic documented here. \title{ An implementation of the bisection algorithm for root finding } \description{ Most of the optimization is \code{Icens} have a one dimensional root-finding component. Since the quantities involved are generally restricted...
library(leaps) library(glmnet) library(randomForest) fit_glm <- function (f, df, fold, k, type = NULL, use_saved = TRUE) { modelname <- getModelName("glm", type) model_path <- getModelPath(dataname, fold, k = k, modelname = modelname) if (use_saved) { if (file.exists(model_path)) { glm_model <- read_m...
/src/subfuncs.R
no_license
stanford-policylab/simple-rules
R
false
false
6,981
r
library(leaps) library(glmnet) library(randomForest) fit_glm <- function (f, df, fold, k, type = NULL, use_saved = TRUE) { modelname <- getModelName("glm", type) model_path <- getModelPath(dataname, fold, k = k, modelname = modelname) if (use_saved) { if (file.exists(model_path)) { glm_model <- read_m...
library(ape) testtree <- read.tree("7597_0.txt") unrooted_tr <- unroot(testtree) write.tree(unrooted_tr, file="7597_0_unrooted.txt")
/codeml_files/newick_trees_processed/7597_0/rinput.R
no_license
DaniBoo/cyanobacteria_project
R
false
false
135
r
library(ape) testtree <- read.tree("7597_0.txt") unrooted_tr <- unroot(testtree) write.tree(unrooted_tr, file="7597_0_unrooted.txt")
# Load Data NEI <- readRDS("summarySCC_PM25.rds") SCC <- readRDS("Source_Classification_Code.rds") # Plot png("plot2.png") NEI.Baltimore <- NEI[NEI$fips == "24510", ] NEI.Baltimore.groups.sum <- with(NEI.Baltimore, tapply(Emissions, year, sum)) plot(NEI.Baltimore.groups.sum ~ names(NEI.Baltimore.groups.sum), type = ...
/plot2.R
no_license
sun33170161/ExData_Plotting2
R
false
false
423
r
# Load Data NEI <- readRDS("summarySCC_PM25.rds") SCC <- readRDS("Source_Classification_Code.rds") # Plot png("plot2.png") NEI.Baltimore <- NEI[NEI$fips == "24510", ] NEI.Baltimore.groups.sum <- with(NEI.Baltimore, tapply(Emissions, year, sum)) plot(NEI.Baltimore.groups.sum ~ names(NEI.Baltimore.groups.sum), type = ...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/data.R \docType{data} \name{data_dictionary_MFD} \alias{data_dictionary_MFD} \title{Moral Foundations Dictionary} \format{An object of class \code{dictionary2} of length 11.} \source{ \url{http://moralfoundations.org/othermaterials} } \usage{...
/man/data_dictionary_MFD.Rd
no_license
evanodell/quanteda.dictionaries
R
false
true
1,120
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/data.R \docType{data} \name{data_dictionary_MFD} \alias{data_dictionary_MFD} \title{Moral Foundations Dictionary} \format{An object of class \code{dictionary2} of length 11.} \source{ \url{http://moralfoundations.org/othermaterials} } \usage{...
cl_trend_plot <- reactive({ validate( need(!is.null(rawData_data$qw_data), "Click the 'Get QW Data' button") ) plot_title <- paste(attr(qwData(), "siteInfo")[["station_nm"]], attr(qwData(), "siteInfo")[["site_no"]], sep = "\n") chl_plot <- trend_plot(qwData(), plot_title = plot_tit...
/inst/single_site/qw_plots.R
permissive
PatrickEslick/HASP
R
false
false
5,086
r
cl_trend_plot <- reactive({ validate( need(!is.null(rawData_data$qw_data), "Click the 'Get QW Data' button") ) plot_title <- paste(attr(qwData(), "siteInfo")[["station_nm"]], attr(qwData(), "siteInfo")[["site_no"]], sep = "\n") chl_plot <- trend_plot(qwData(), plot_title = plot_tit...
#' Mutate a set of node attribute values #' @description Within a graph's internal node data #' frame (ndf), mutate numeric node attribute values #' using one or more expressions. Optionally, one can #' specify a different node attribute name and create #' a new node attribute while retaining the original #' node attri...
/R/mutate_node_attrs.R
no_license
applied-statistic-using-r/DiagrammeR
R
false
false
6,967
r
#' Mutate a set of node attribute values #' @description Within a graph's internal node data #' frame (ndf), mutate numeric node attribute values #' using one or more expressions. Optionally, one can #' specify a different node attribute name and create #' a new node attribute while retaining the original #' node attri...
#filter out snp positions that have less than 4 reads to eliminate the structure I found in the data ####### #snp<-read.table("/Users/wendy/Dropbox/Sol96_LogitRegression/Minor_Major_SNP_data.txt",header=T,sep=",") geno.reads<-read.table("/Users/wendy/Dropbox/Sol96_LogitRegression/vcf_geno_depth_filter_200KSNP.txt",head...
/Regression_Scripts/LogisticRegression_Script.R
no_license
wendyvu216/Oil-Palm-Genetic-Diversity-and-Conservation-Program
R
false
false
9,012
r
#filter out snp positions that have less than 4 reads to eliminate the structure I found in the data ####### #snp<-read.table("/Users/wendy/Dropbox/Sol96_LogitRegression/Minor_Major_SNP_data.txt",header=T,sep=",") geno.reads<-read.table("/Users/wendy/Dropbox/Sol96_LogitRegression/vcf_geno_depth_filter_200KSNP.txt",head...
list2matrix.bma = function(x, what, which.models=NULL) { namesx = x$namesx if (is.null(which.models)) which.models= 1:x$n.models listobj = x[[what]][which.models] which = x$which[which.models] n.models = length(which.models) p = length(namesx) mat = matrix(0, nrow=n.models, ncol=p) for (i in 1:n.mod...
/supplementaries/Mode Jumping MCMC/supplementary/examples/BAS archive/BAS/R/as.matrix.R
no_license
aliaksah/EMJMCMC2016
R
false
false
1,209
r
list2matrix.bma = function(x, what, which.models=NULL) { namesx = x$namesx if (is.null(which.models)) which.models= 1:x$n.models listobj = x[[what]][which.models] which = x$which[which.models] n.models = length(which.models) p = length(namesx) mat = matrix(0, nrow=n.models, ncol=p) for (i in 1:n.mod...
# server.R library(dplyr) library(shiny) library(plotly) # Read in data source('./scripts/build_map.R') df <- read.csv('./data/electoral_college.csv', stringsAsFactors = FALSE) state_codes <- read.csv('./data/state_codes.csv', stringsAsFactors = FALSE) # Join together state.codes and df joined_data <- left_join(df, s...
/chapter-19-exercises/exercise-6/app_server.R
permissive
sumeetwaraich/book-exercises
R
false
false
675
r
# server.R library(dplyr) library(shiny) library(plotly) # Read in data source('./scripts/build_map.R') df <- read.csv('./data/electoral_college.csv', stringsAsFactors = FALSE) state_codes <- read.csv('./data/state_codes.csv', stringsAsFactors = FALSE) # Join together state.codes and df joined_data <- left_join(df, s...
# Race group differences in social dist variables in tempdiscsocialdist data set # 7.14.20 # load required packages library(here) library(tidyverse) library(rstatix) # load source functions # set hard-coded variables # load data if (sample == 1) { dt <- read.csv(here::here("data", "tdsd_s1_data.csv")) dd <- ...
/12_racial_differences.R
no_license
klsea/tempdiscsocialdist
R
false
false
1,864
r
# Race group differences in social dist variables in tempdiscsocialdist data set # 7.14.20 # load required packages library(here) library(tidyverse) library(rstatix) # load source functions # set hard-coded variables # load data if (sample == 1) { dt <- read.csv(here::here("data", "tdsd_s1_data.csv")) dd <- ...
ReadIntercatch <- function(file){ IC <- read.table(file ,sep=",", col.names=as.character(1:33), fill=T) HI <- subset(IC,X1=='HI')[,1:12] names(HI) <- c("RecordType", "Country", "Year", "SeasonType", "Season", "Fleet", "AreaType", "FishingArea", "DepthRange", "UnitEffort", "Effort", ...
/WKRDB-EST/Personal_folders/Hans/ReadIntercatch.R
no_license
ices-eg/WK_RDBES
R
false
false
2,384
r
ReadIntercatch <- function(file){ IC <- read.table(file ,sep=",", col.names=as.character(1:33), fill=T) HI <- subset(IC,X1=='HI')[,1:12] names(HI) <- c("RecordType", "Country", "Year", "SeasonType", "Season", "Fleet", "AreaType", "FishingArea", "DepthRange", "UnitEffort", "Effort", ...
### make plot for eaf reference ### # load data library(data.table) setwd("/home/common/projects/ovine_selection/ovines_gwas_map/sheep_reference") reference <- fread("sheep_reference.txt", head=T, stringsAsFactors=F, data.table=F) # make table for plot for_plot <- matrix(ncol=4, nrow=6) for_plot[1,...
/04_do_plots_and_tables_for_reports/04b_make_plot_for_eaf_reference.R
no_license
Defrag1236/ovines_gwas_map
R
false
false
1,485
r
### make plot for eaf reference ### # load data library(data.table) setwd("/home/common/projects/ovine_selection/ovines_gwas_map/sheep_reference") reference <- fread("sheep_reference.txt", head=T, stringsAsFactors=F, data.table=F) # make table for plot for_plot <- matrix(ncol=4, nrow=6) for_plot[1,...
\name{difshannonbio} \alias{difshannonbio} \title{ Empirical confidence interval of the bootstrap of the difference between two Shannon indices } \description{ Computes the empirical confidence interval of the bootstrap of the difference between two Shannon indices } \usage{ difshannonbio(dat1, dat2, R = 1000, probs...
/pgirmess/man/difshannonbio.rd
no_license
pgiraudoux/pgirmess
R
false
false
1,214
rd
\name{difshannonbio} \alias{difshannonbio} \title{ Empirical confidence interval of the bootstrap of the difference between two Shannon indices } \description{ Computes the empirical confidence interval of the bootstrap of the difference between two Shannon indices } \usage{ difshannonbio(dat1, dat2, R = 1000, probs...
### R code from vignette source 'intro.Rnw' ### Encoding: UTF-8 ################################################### ### code chunk number 1: intro.Rnw:26-27 ################################################### options(keep.source=TRUE) ################################################### ### code chunk numbe...
/REU R Workshop/REU R Workshop/W1_Intro/intro_v2.R
no_license
jwaring8/REU
R
false
false
14,053
r
### R code from vignette source 'intro.Rnw' ### Encoding: UTF-8 ################################################### ### code chunk number 1: intro.Rnw:26-27 ################################################### options(keep.source=TRUE) ################################################### ### code chunk numbe...
sum_i <- function(v, i) { if (i < 1) { return(0) } j <- i if (j > length(v)) { j <- length(v) } sum(v[1]:v[j]) }
/src/week_2/prob-1.R
permissive
haunt98/R-learn
R
false
false
153
r
sum_i <- function(v, i) { if (i < 1) { return(0) } j <- i if (j > length(v)) { j <- length(v) } sum(v[1]:v[j]) }
# R commands for working with Mr. Doyle's data library(lubridate) library(tidyverse) x <- read_csv("spreadspoke_scores.csv", guess_max = 10000) %>% mutate(schedule_week = recode(schedule_week, "SuperBowl" = "Superbowl", "WildCard" = "Wildcard")) %>%...
/kane.R
no_license
tianan2/Final-Project
R
false
false
671
r
# R commands for working with Mr. Doyle's data library(lubridate) library(tidyverse) x <- read_csv("spreadspoke_scores.csv", guess_max = 10000) %>% mutate(schedule_week = recode(schedule_week, "SuperBowl" = "Superbowl", "WildCard" = "Wildcard")) %>%...
library(tidyverse) range01 <- function(x){(x-min(x))/(max(x)-min(x))} # alumnos ----------------------------------------------------------------- set.seed(1) N <- 3000 x <- rnorm(N) m <- -0.5555556 b <- 8.3333333 y <- m * x + b + rnorm(length(x)) plot(x, y, col="gray", pch=20, asp=1) fit <- lm(y ~ x) abline(fit, lty=...
/R/99-data.R
no_license
jbkunst/puc-introduccion-a-R
R
false
false
2,424
r
library(tidyverse) range01 <- function(x){(x-min(x))/(max(x)-min(x))} # alumnos ----------------------------------------------------------------- set.seed(1) N <- 3000 x <- rnorm(N) m <- -0.5555556 b <- 8.3333333 y <- m * x + b + rnorm(length(x)) plot(x, y, col="gray", pch=20, asp=1) fit <- lm(y ~ x) abline(fit, lty=...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/binCounts.R \name{binCounts} \alias{binCounts} \title{Fast element counting in non-overlapping bins} \usage{ binCounts(x, idxs = NULL, bx, right = FALSE, ...) } \arguments{ \item{x}{A \code{\link[base]{numeric}} \code{\link[base]{vector}} of ...
/man/binCounts.Rd
no_license
HenrikBengtsson/matrixStats
R
false
true
1,953
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/binCounts.R \name{binCounts} \alias{binCounts} \title{Fast element counting in non-overlapping bins} \usage{ binCounts(x, idxs = NULL, bx, right = FALSE, ...) } \arguments{ \item{x}{A \code{\link[base]{numeric}} \code{\link[base]{vector}} of ...
## Put comments here that give an overall description of what your ## functions do ## Write a short comment describing this function ## This function creates a special "matrix" object that can cache its inverse. ## x is the input matrix, defaulf value is matrix(). ## set() can change the input matrix. ## get() can get...
/cachematrix.R
no_license
hanruyu/ProgrammingAssignment2
R
false
false
1,305
r
## Put comments here that give an overall description of what your ## functions do ## Write a short comment describing this function ## This function creates a special "matrix" object that can cache its inverse. ## x is the input matrix, defaulf value is matrix(). ## set() can change the input matrix. ## get() can get...
# # Utilities needed for preprocessing & analysing NCDC weather dataset # (Can be regularly updated) # # String for latitude-longitude projection (can be passed into CRS) g_latlongProj_str <- "+proj=longlat +datum=WGS84" # Function to remove temporary objects ## Convention: name starting with 'c_' rmMyTemp_fn <- func...
/000_utils.R
no_license
ybaek/undergrad
R
false
false
6,200
r
# # Utilities needed for preprocessing & analysing NCDC weather dataset # (Can be regularly updated) # # String for latitude-longitude projection (can be passed into CRS) g_latlongProj_str <- "+proj=longlat +datum=WGS84" # Function to remove temporary objects ## Convention: name starting with 'c_' rmMyTemp_fn <- func...
\name{predict.mixGGM} \alias{predict.mixGGM} \title{Cluster prediction by Mixture of Gaussian Graphical Models} \description{Cluster prediction for multivariate observations based on Mixture of Gaussian Graphical Models estimated by \code{\link{mixGGM}}.} \usage{ \method{predict}{mixGGM}(object, newdata, \dots) } \...
/man/predict.mixGGM.Rd
no_license
lkampoli/mixggm
R
false
false
1,026
rd
\name{predict.mixGGM} \alias{predict.mixGGM} \title{Cluster prediction by Mixture of Gaussian Graphical Models} \description{Cluster prediction for multivariate observations based on Mixture of Gaussian Graphical Models estimated by \code{\link{mixGGM}}.} \usage{ \method{predict}{mixGGM}(object, newdata, \dots) } \...
library("dplyr") library("tidyverse") library("lubridate") rm(list=ls()) setwd(here::here("output", "measures")) df1 <- readRDS('ab_type_pre.rds') df2 <- readRDS('ab_type_2019.rds') df3 <- readRDS('ab_type_2020.rds') df4 <- readRDS('ab_type_2021.rds') df5 <- readRDS('ab_type_2022.rds') df2 <- bind_rows(df2) df3 <- bi...
/analysis/plot/amoxicillin_percentage_by_age.R
permissive
opensafely/amr-uom-brit
R
false
false
4,160
r
library("dplyr") library("tidyverse") library("lubridate") rm(list=ls()) setwd(here::here("output", "measures")) df1 <- readRDS('ab_type_pre.rds') df2 <- readRDS('ab_type_2019.rds') df3 <- readRDS('ab_type_2020.rds') df4 <- readRDS('ab_type_2021.rds') df5 <- readRDS('ab_type_2022.rds') df2 <- bind_rows(df2) df3 <- bi...
library(yorkr) ### Name: teamBowlersWicketRunsOppnAllMatches ### Title: Team bowlers wicket runs against an opposition in all matches ### Aliases: teamBowlersWicketRunsOppnAllMatches ### ** Examples ## Not run: ##D # Get all matches between India and Australia ##D matches <- getAllMatchesBetweenTeams("Australia","...
/data/genthat_extracted_code/yorkr/examples/teamBowlersWicketRunsOppnAllMatches.Rd.R
no_license
surayaaramli/typeRrh
R
false
false
520
r
library(yorkr) ### Name: teamBowlersWicketRunsOppnAllMatches ### Title: Team bowlers wicket runs against an opposition in all matches ### Aliases: teamBowlersWicketRunsOppnAllMatches ### ** Examples ## Not run: ##D # Get all matches between India and Australia ##D matches <- getAllMatchesBetweenTeams("Australia","...
JACCARD.F <- function(partHard, partFuzzy, t_norm = c("minimum","product")) { if (missing(partHard)) stop("The hard partitions partHard must be given") if (missing(partFuzzy)) stop("The fuzzy partitions partFuzzy must be given") if (is.null(partHard)) stop("The hard partitions partHard is empty") ...
/R/JACCARD.F.R
no_license
bratnick/fclust
R
false
false
763
r
JACCARD.F <- function(partHard, partFuzzy, t_norm = c("minimum","product")) { if (missing(partHard)) stop("The hard partitions partHard must be given") if (missing(partFuzzy)) stop("The fuzzy partitions partFuzzy must be given") if (is.null(partHard)) stop("The hard partitions partHard is empty") ...
library(xts) library(lubridate) library(raster) library(ncdf4) pct09=read.csv("WT_data/pct09.cla",sep="",header=F) san09=read.csv("WT_data/san09_500HGT.cla",sep="",header=F) WTS=data.frame(WT_pct09=as.factor(pct09$V5), WT_san09=as.factor(san09$V5[1:13545]) ) rownames(WTS)=ISOdate(pct09...
/WT_init_proc.r
no_license
CLIMAIBIMETCNR/seasonal_forecast
R
false
false
7,029
r
library(xts) library(lubridate) library(raster) library(ncdf4) pct09=read.csv("WT_data/pct09.cla",sep="",header=F) san09=read.csv("WT_data/san09_500HGT.cla",sep="",header=F) WTS=data.frame(WT_pct09=as.factor(pct09$V5), WT_san09=as.factor(san09$V5[1:13545]) ) rownames(WTS)=ISOdate(pct09...
test_that("Hemis can be shifted apart using rglactions for non-overlapping rendering.", { testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests. skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be...
/tests/testthat/test-rglactions.R
permissive
adigherman/fsbrain
R
false
false
1,220
r
test_that("Hemis can be shifted apart using rglactions for non-overlapping rendering.", { testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests. skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be...
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #' Sample from the Dirichlet distribution #' #' @param n number ofsample #' @param a vector of weights #' #' @export rdirichlet <- function(n, a) { .Call(`_dist_rdirichlet`, n, a) } #' Sam...
/R/RcppExports.R
no_license
mkomod/dist
R
false
false
1,428
r
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #' Sample from the Dirichlet distribution #' #' @param n number ofsample #' @param a vector of weights #' #' @export rdirichlet <- function(n, a) { .Call(`_dist_rdirichlet`, n, a) } #' Sam...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/drugSetEnrichment.R \name{matchStatsWithDrugSetsID} \alias{matchStatsWithDrugSetsID} \title{Match identifiers between data and drug sets} \usage{ matchStatsWithDrugSetsID( sets, stats, col = "values", keyColSets = NULL, keyColStats ...
/man/matchStatsWithDrugSetsID.Rd
permissive
nuno-agostinho/cTRAP
R
false
true
1,435
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/drugSetEnrichment.R \name{matchStatsWithDrugSetsID} \alias{matchStatsWithDrugSetsID} \title{Match identifiers between data and drug sets} \usage{ matchStatsWithDrugSetsID( sets, stats, col = "values", keyColSets = NULL, keyColStats ...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/qvcalc.PlackettLuce.R \name{qvcalc.PlackettLuce} \alias{qvcalc.PlackettLuce} \title{Quasi Variances for Model Coefficients} \usage{ \method{qvcalc}{PlackettLuce}(object, ref = 1, ...) } \arguments{ \item{object}{a \code{"PlackettLuce"} object...
/man/qvcalc.PlackettLuce.Rd
no_license
anhnguyendepocen/PlackettLuce
R
false
true
3,623
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/qvcalc.PlackettLuce.R \name{qvcalc.PlackettLuce} \alias{qvcalc.PlackettLuce} \title{Quasi Variances for Model Coefficients} \usage{ \method{qvcalc}{PlackettLuce}(object, ref = 1, ...) } \arguments{ \item{object}{a \code{"PlackettLuce"} object...
# incluir imagenes en ggplots: # https://drmowinckels.io/blog/adding-external-images-to-plots/ # ggimage library(tidyverse) library(ggplot2) library(jpeg) library(grid) library(ggdark) library(showtext) theme_set(dark_theme_grey()) metallica <- readRDS("metallica.rds") # does not work! # mutate(track_name = fct_ino...
/visualize.R
no_license
rlabuonora/metallica_viz
R
false
false
4,862
r
# incluir imagenes en ggplots: # https://drmowinckels.io/blog/adding-external-images-to-plots/ # ggimage library(tidyverse) library(ggplot2) library(jpeg) library(grid) library(ggdark) library(showtext) theme_set(dark_theme_grey()) metallica <- readRDS("metallica.rds") # does not work! # mutate(track_name = fct_ino...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/ogbox.R \name{roxygenTabular} \alias{roxygenTabular} \title{Roxygen table maker} \usage{ roxygenTabular(df, col.names = TRUE, ...) } \arguments{ \item{df}{data.frame} \item{col.names}{logica. If colnames should be included} \item{...}{varia...
/man/roxygenTabular.Rd
permissive
oganm/ogbox
R
false
true
384
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/ogbox.R \name{roxygenTabular} \alias{roxygenTabular} \title{Roxygen table maker} \usage{ roxygenTabular(df, col.names = TRUE, ...) } \arguments{ \item{df}{data.frame} \item{col.names}{logica. If colnames should be included} \item{...}{varia...
#' The base Choropleth object. #' @importFrom R6 R6Class #' @importFrom scales comma #' @importFrom ggplot2 scale_color_continuous coord_quickmap #' @export Choropleth = R6Class("Choropleth", public = list( # the key objects for this class user.df = NULL, # input from user ma...
/R/choropleth.R
no_license
cardiomoon/choroplethr
R
false
false
9,370
r
#' The base Choropleth object. #' @importFrom R6 R6Class #' @importFrom scales comma #' @importFrom ggplot2 scale_color_continuous coord_quickmap #' @export Choropleth = R6Class("Choropleth", public = list( # the key objects for this class user.df = NULL, # input from user ma...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrim_flexible.R \name{discrim_flexible} \alias{discrim_flexible} \title{Flexible discriminant analysis} \usage{ discrim_flexible( mode = "classification", num_terms = NULL, prod_degree = NULL, prune_method = NULL, engine = "earth...
/man/discrim_flexible.Rd
permissive
tidymodels/parsnip
R
false
true
2,265
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrim_flexible.R \name{discrim_flexible} \alias{discrim_flexible} \title{Flexible discriminant analysis} \usage{ discrim_flexible( mode = "classification", num_terms = NULL, prod_degree = NULL, prune_method = NULL, engine = "earth...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/plot_fns.R \name{plot.corRes} \alias{plot.corRes} \title{Plot corRes Object} \usage{ \method{plot}{corRes}( corRes_obj, omicsData = NULL, order_by = NULL, colorbar_lim = c(NA, NA), x_text = TRUE, y_text = TRUE, interactive = FAL...
/man/plot-corRes.Rd
permissive
clabornd/pmartR
R
false
true
3,441
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/plot_fns.R \name{plot.corRes} \alias{plot.corRes} \title{Plot corRes Object} \usage{ \method{plot}{corRes}( corRes_obj, omicsData = NULL, order_by = NULL, colorbar_lim = c(NA, NA), x_text = TRUE, y_text = TRUE, interactive = FAL...
(function(e,t){function u(e){var t=o[e]={},n,r;e=e.split(/\s+/);for(n=0,r=e.length;n<r;n++){t[e[n]]=true}return t}function c(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(l,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r==="string"){try{r=r==="true"?true:r==="false"?false:r==="null"?null:s.isNumeric(r)?...
/Css/jquery_002.js
no_license
Aadil25/mvcphp
R
true
true
324,398
js
(function(e,t){function u(e){var t=o[e]={},n,r;e=e.split(/\s+/);for(n=0,r=e.length;n<r;n++){t[e[n]]=true}return t}function c(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(l,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r==="string"){try{r=r==="true"?true:r==="false"?false:r==="null"?null:s.isNumeric(r)?...
% Generated by roxygen2 (4.1.1): do not edit by hand % Please edit documentation in R/mxnet_generated.R \name{mx.symbol.LinearRegressionOutput} \alias{mx.symbol.LinearRegressionOutput} \title{Use linear regression for final output, this is used on final output of a net.} \usage{ mx.symbol.LinearRegressionOutput(...) } ...
/R-package/man/mx.symbol.LinearRegressionOutput.Rd
permissive
XinliangZhu/mxnet
R
false
false
617
rd
% Generated by roxygen2 (4.1.1): do not edit by hand % Please edit documentation in R/mxnet_generated.R \name{mx.symbol.LinearRegressionOutput} \alias{mx.symbol.LinearRegressionOutput} \title{Use linear regression for final output, this is used on final output of a net.} \usage{ mx.symbol.LinearRegressionOutput(...) } ...
## Put comments here that give an overall description of what your ## functions do ## This function creates a special "matrix" object that can cache ## its inverse. makeCacheMatrix <- function(x = matrix()) { inv <- NULL set <- function(y) { x <<- y inv <<- NULL } get <- function() x ...
/cachematrix.R
no_license
LouayMalatili/ProgrammingAssignment2
R
false
false
1,017
r
## Put comments here that give an overall description of what your ## functions do ## This function creates a special "matrix" object that can cache ## its inverse. makeCacheMatrix <- function(x = matrix()) { inv <- NULL set <- function(y) { x <<- y inv <<- NULL } get <- function() x ...
context("sampler2_cpp") test_that("sampler_cpp2", { set.seed(4711) N <- 1000 D <- 17 V <- 31 K <- 10 P <- 3 state_df <- data.frame(doc = sample(1:D, size = N, replace = TRUE), type = sample(1:V, size = N, replace = TRUE), topic = sample(1:K, size = N, rep...
/tests/testthat/test-sampler2_cpp.R
no_license
MansMeg/PerspectiveTopicModel
R
false
false
3,598
r
context("sampler2_cpp") test_that("sampler_cpp2", { set.seed(4711) N <- 1000 D <- 17 V <- 31 K <- 10 P <- 3 state_df <- data.frame(doc = sample(1:D, size = N, replace = TRUE), type = sample(1:V, size = N, replace = TRUE), topic = sample(1:K, size = N, rep...
library(bigsnpr) gen <- function(n, m) { I <- 1:m p <- I / (2 * m + 1) mat <- outer(I, I, FUN = function(i, j) { 1 / (abs(i - j) + 1) }) bindata::rmvbin(n, p, bincorr = mat) + bindata::rmvbin(n, p, bincorr = mat) } N <- 200 M <- 500 fake <- snp_fake(N, M) G <- fake$genotypes G[] <- rep(gen(N, M /...
/data-raw/example-missing.R
no_license
privefl/bigsnpr
R
false
false
673
r
library(bigsnpr) gen <- function(n, m) { I <- 1:m p <- I / (2 * m + 1) mat <- outer(I, I, FUN = function(i, j) { 1 / (abs(i - j) + 1) }) bindata::rmvbin(n, p, bincorr = mat) + bindata::rmvbin(n, p, bincorr = mat) } N <- 200 M <- 500 fake <- snp_fake(N, M) G <- fake$genotypes G[] <- rep(gen(N, M /...
# ------------------------------------------------------------------ # This material is distributed under the GNU General Public License # Version 2. You may review the terms of this license at # http://www.gnu.org/licenses/gpl-2.0.html # # Copyright (c) 2012-2013, Michel Lang, Helena Kotthaus, # TU Dortmund University...
/MachineLearningAlg/main_functions/lm.R
no_license
allr/benchR
R
false
false
1,139
r
# ------------------------------------------------------------------ # This material is distributed under the GNU General Public License # Version 2. You may review the terms of this license at # http://www.gnu.org/licenses/gpl-2.0.html # # Copyright (c) 2012-2013, Michel Lang, Helena Kotthaus, # TU Dortmund University...
##################### # Oct 26, 2018 # Making sure that I can clone and comit R scripts with Git via the terminal # doing this as a test ###################### setwd("Z:/GitHub/hello-world") main.dir<-"Z:/GitHub/" # in terminal: git clone https://github.com/StewartResearch/hello-world.git # now make some changes # g...
/Hello-World.R
no_license
StewartResearch/hello-world
R
false
false
2,705
r
##################### # Oct 26, 2018 # Making sure that I can clone and comit R scripts with Git via the terminal # doing this as a test ###################### setwd("Z:/GitHub/hello-world") main.dir<-"Z:/GitHub/" # in terminal: git clone https://github.com/StewartResearch/hello-world.git # now make some changes # g...
library(testthat) test_check("gmo")
/tests/testthat.R
permissive
jan-glx/gmo
R
false
false
36
r
library(testthat) test_check("gmo")
# Example of Machine Learning algorithm using "Decision trees" # with R's carot package. # MAIN IDEAS # # *Iteratively split variables into groups # *Eval homogeneity with each group # *Split again if necessary # BASIC ALGORITHM # # 1.- Start with all variables in one group # 2.- Find variable that best sep...
/8_machine/decision_trees.R
no_license
chuymtz/datasciencecoursera
R
false
false
1,873
r
# Example of Machine Learning algorithm using "Decision trees" # with R's carot package. # MAIN IDEAS # # *Iteratively split variables into groups # *Eval homogeneity with each group # *Split again if necessary # BASIC ALGORITHM # # 1.- Start with all variables in one group # 2.- Find variable that best sep...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/sagemaker_operations.R \name{sagemaker_create_experiment} \alias{sagemaker_create_experiment} \title{Creates an Amazon SageMaker \emph{experiment}} \usage{ sagemaker_create_experiment(ExperimentName, DisplayName, Description, Tags) } \argum...
/cran/paws.machine.learning/man/sagemaker_create_experiment.Rd
permissive
johnnytommy/paws
R
false
true
2,407
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/sagemaker_operations.R \name{sagemaker_create_experiment} \alias{sagemaker_create_experiment} \title{Creates an Amazon SageMaker \emph{experiment}} \usage{ sagemaker_create_experiment(ExperimentName, DisplayName, Description, Tags) } \argum...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/getAllAreaData.R \name{getAllAreaData} \alias{getAllAreaData} \title{Get All Area Data} \usage{ getAllAreaData() } \description{ Description }
/man/getAllAreaData.Rd
no_license
SWS-Methodology/faoswsSeed
R
false
true
222
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/getAllAreaData.R \name{getAllAreaData} \alias{getAllAreaData} \title{Get All Area Data} \usage{ getAllAreaData() } \description{ Description }
% Generated by roxygen2 (4.0.1): do not edit by hand \name{NetworkModel} \alias{NetworkModel} \title{Instantiates an object of class NetworkModel} \usage{ NetworkModel(model_params = set_model_param()) } \arguments{ \item{model_params}{[list; DEFAULT = \code{\link{set_model_param}}()] :: Model parameters} } \value{ [Ne...
/netcompLib/man/NetworkModel.Rd
no_license
minghao2016/netcompLib
R
false
false
450
rd
% Generated by roxygen2 (4.0.1): do not edit by hand \name{NetworkModel} \alias{NetworkModel} \title{Instantiates an object of class NetworkModel} \usage{ NetworkModel(model_params = set_model_param()) } \arguments{ \item{model_params}{[list; DEFAULT = \code{\link{set_model_param}}()] :: Model parameters} } \value{ [Ne...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/get_more.R \name{get_primary} \alias{get_primary} \title{Primary room size (primærrom)} \usage{ get_primary(x) } \arguments{ \item{x}{HTML code} } \description{ Primary room size (primærrom) }
/man/get_primary.Rd
no_license
ybkamaleri/boligfinn
R
false
true
273
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/get_more.R \name{get_primary} \alias{get_primary} \title{Primary room size (primærrom)} \usage{ get_primary(x) } \arguments{ \item{x}{HTML code} } \description{ Primary room size (primærrom) }
# FUNCTIONS IN THIS FILE: # improve # isUnimodal # isMonotoneR # isMonotoneL # isBoundedL # isBoundedR #***************************************************************************************** #*** improve ***************************************************************************** #***...
/R/sharpenedKDE.R
no_license
cran/scdensity
R
false
false
14,730
r
# FUNCTIONS IN THIS FILE: # improve # isUnimodal # isMonotoneR # isMonotoneL # isBoundedL # isBoundedR #***************************************************************************************** #*** improve ***************************************************************************** #***...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/sdwis_enforcement_action.R \name{sdwis_enforcement_action} \alias{sdwis_enforcement_action} \title{Retrieve enforcement action data from sdwis database} \usage{ sdwis_enforcement_action(PWSID = NULL, ENFORCEMENT_ID = NULL, ORIGINATOR_CODE =...
/man/sdwis_enforcement_action.Rd
no_license
markwh/envirofacts
R
false
true
944
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/sdwis_enforcement_action.R \name{sdwis_enforcement_action} \alias{sdwis_enforcement_action} \title{Retrieve enforcement action data from sdwis database} \usage{ sdwis_enforcement_action(PWSID = NULL, ENFORCEMENT_ID = NULL, ORIGINATOR_CODE =...
#' Calculate amount excreted (typically in urine or feces) #' #' @param conc The concentration in the sample #' @param volume The volume (or mass) of the sample #' @param check Should the concentration and volume data be checked? #' @return The amount excreted during the interval #' @details The units for the concentr...
/R/pk.calc.urine.R
no_license
ksl31/pknca
R
false
false
2,844
r
#' Calculate amount excreted (typically in urine or feces) #' #' @param conc The concentration in the sample #' @param volume The volume (or mass) of the sample #' @param check Should the concentration and volume data be checked? #' @return The amount excreted during the interval #' @details The units for the concentr...
#Importing Data train <- read.csv(file.choose(), na.strings = c(""," ",NA)) #Finding missing values sort(colSums(is.na(train)), decreasing = TRUE) #Data Exploration library(ggplot2) library(dplyr) data <- train # Total Number of Passengers: 891 NROW(data$PassengerId) #Total Number of Passengers - Dead:549 Live:342 t...
/Titanic.R
no_license
Hemanthkaruturi/Titanic
R
false
false
8,910
r
#Importing Data train <- read.csv(file.choose(), na.strings = c(""," ",NA)) #Finding missing values sort(colSums(is.na(train)), decreasing = TRUE) #Data Exploration library(ggplot2) library(dplyr) data <- train # Total Number of Passengers: 891 NROW(data$PassengerId) #Total Number of Passengers - Dead:549 Live:342 t...
#Load required packages library(forecast) library(xts) library(lubridate) seaice<-read.csv("seaice.csv",header = TRUE,stringsAsFactors = FALSE) str(seaice) north_hemi<-seaice[seaice$hemisphere=='north',] seaice$Date<-as.Date(paste(seaice$Year,seaice$Month,seaice$Day,sep = '-')) #create initial time series object ...
/time_series_pred.R
no_license
bhisecj/Time_Series_Prediction
R
false
false
1,680
r
#Load required packages library(forecast) library(xts) library(lubridate) seaice<-read.csv("seaice.csv",header = TRUE,stringsAsFactors = FALSE) str(seaice) north_hemi<-seaice[seaice$hemisphere=='north',] seaice$Date<-as.Date(paste(seaice$Year,seaice$Month,seaice$Day,sep = '-')) #create initial time series object ...
timestamp <- Sys.time() library(caret) library(plyr) library(recipes) library(dplyr) model <- "Rborist" ## In case the package or one of its dependencies uses random numbers ## on startup so we'll pre-load the required libraries: for(i in getModelInfo(model)[[1]]$library) do.call("require", list(package = i)) ##...
/RegressionTests/Code/Rborist.R
no_license
Weekend-Warrior/caret
R
false
false
8,069
r
timestamp <- Sys.time() library(caret) library(plyr) library(recipes) library(dplyr) model <- "Rborist" ## In case the package or one of its dependencies uses random numbers ## on startup so we'll pre-load the required libraries: for(i in getModelInfo(model)[[1]]$library) do.call("require", list(package = i)) ##...
# #The goal of this script is to run enrichment analysi on the leading edges of different clusters listOfFiles = list.files("03_extractedData/190321_KO-RNAseq/GSEA/leadingEdges/") #Load transcriptome and keep only genes expressed in at least one sample. expressedTranscriptome = read.table("01_rawData/190321_KO-RNAseq...
/05_scripts/190321_KO-RNAseq/190408_runClusterProfilerOnLeadingEdges.R
no_license
edatorre/2020_TorreEtAl_data
R
false
false
2,441
r
# #The goal of this script is to run enrichment analysi on the leading edges of different clusters listOfFiles = list.files("03_extractedData/190321_KO-RNAseq/GSEA/leadingEdges/") #Load transcriptome and keep only genes expressed in at least one sample. expressedTranscriptome = read.table("01_rawData/190321_KO-RNAseq...
% Generated by roxygen2 (4.1.0): do not edit by hand % Please edit documentation in R/gaussAlgebra.R \name{linear.gAlg} \alias{linear.gAlg} \title{Generates a linear gAlg function} \usage{ linear.gAlg(k, d = 1) } \arguments{ \item{k}{Index of the dimension in which the function is linear} \item{d}{Dimension in which t...
/man/linear.gAlg.Rd
no_license
kmarchlewski/gaussAlgebra
R
false
false
416
rd
% Generated by roxygen2 (4.1.0): do not edit by hand % Please edit documentation in R/gaussAlgebra.R \name{linear.gAlg} \alias{linear.gAlg} \title{Generates a linear gAlg function} \usage{ linear.gAlg(k, d = 1) } \arguments{ \item{k}{Index of the dimension in which the function is linear} \item{d}{Dimension in which t...
# simulate gaussian rv with correlation 0.5 simulate_x = function(){ cov = matrix(c(1,0.5,0.5,1),nrow=2) A = t(chol(cov)) e = matrix(rnorm(2),nrow=2) x = A %*% rnorm(2) x } simulate_path=function(){ T = 365-1 x1 = vector();x2 = vector() for(i in 1:T){ x = simulate_x() x1 = c(x1,x[1]) x2 = c(x2,x[2]) }...
/StochasticProcess/question4.R
no_license
fushuyue/Financial_Computing
R
false
false
1,371
r
# simulate gaussian rv with correlation 0.5 simulate_x = function(){ cov = matrix(c(1,0.5,0.5,1),nrow=2) A = t(chol(cov)) e = matrix(rnorm(2),nrow=2) x = A %*% rnorm(2) x } simulate_path=function(){ T = 365-1 x1 = vector();x2 = vector() for(i in 1:T){ x = simulate_x() x1 = c(x1,x[1]) x2 = c(x2,x[2]) }...
\name{PKMW} \alias{PKMW} \title{Presmoothed Kaplan-Meier weights} \description{This function returns a vector with the presmoothed Kaplan-Meier weights.} \usage{ PKMW(time, status) } \arguments{ \item{time}{ Survival time of the process.} \item{status}{Censoring indicator of the survival time of the process; 0 if...
/man/PKMW.Rd
no_license
sestelo/survidm
R
false
false
1,095
rd
\name{PKMW} \alias{PKMW} \title{Presmoothed Kaplan-Meier weights} \description{This function returns a vector with the presmoothed Kaplan-Meier weights.} \usage{ PKMW(time, status) } \arguments{ \item{time}{ Survival time of the process.} \item{status}{Censoring indicator of the survival time of the process; 0 if...
# How have emissions from # motor vehicle sources changed from 1999–2008 in Baltimore City? # Read the data setwd("~/40 L&G/Coursera/ExDataAnalysis/Project2") if (!exists("NEI")) { # Emissions Data NEI <- readRDS(paste0(getwd() ,"/Data/summarySCC_PM25.rds")) } if (!exists("SCC")) { # Source Cl...
/plot6.R
no_license
Kbushu/Pollution
R
false
false
1,342
r
# How have emissions from # motor vehicle sources changed from 1999–2008 in Baltimore City? # Read the data setwd("~/40 L&G/Coursera/ExDataAnalysis/Project2") if (!exists("NEI")) { # Emissions Data NEI <- readRDS(paste0(getwd() ,"/Data/summarySCC_PM25.rds")) } if (!exists("SCC")) { # Source Cl...
# SVR # Importing the dataset dataset = read.csv('Position_Salaries.csv') dataset = dataset[2:3] # Splitting the dataset into the Training set and Test set # # install.packages('caTools') # library(caTools) # set.seed(123) # split = sample.split(dataset$Salary, SplitRatio = 2/3) # training_set = subset(dataset, split...
/Machine Learning A-Z- Udemy/Part 2 - Regression/Section 7 - Support Vector Regression (SVR)/svr.R
no_license
95anantsingh/Udemy-ML-A-Z
R
false
false
1,586
r
# SVR # Importing the dataset dataset = read.csv('Position_Salaries.csv') dataset = dataset[2:3] # Splitting the dataset into the Training set and Test set # # install.packages('caTools') # library(caTools) # set.seed(123) # split = sample.split(dataset$Salary, SplitRatio = 2/3) # training_set = subset(dataset, split...
#Sam Smedinghoff #7/27/18 #Week 3 - Lab 3 library(SDSFoundations) post <- PostSurvey #Question 1 post$hw_hours_diff <- post$hw_hours_HS - post$hw_hours_college hist(post$hw_hours_diff) t.test(post$hw_hours_HS,post$hw_hours_college,paired=T,alternative='less') #Question 2 sleep_greek <- post$sleep_Sat[po...
/FDA2/lab03.R
no_license
smeds1/Learning
R
false
false
490
r
#Sam Smedinghoff #7/27/18 #Week 3 - Lab 3 library(SDSFoundations) post <- PostSurvey #Question 1 post$hw_hours_diff <- post$hw_hours_HS - post$hw_hours_college hist(post$hw_hours_diff) t.test(post$hw_hours_HS,post$hw_hours_college,paired=T,alternative='less') #Question 2 sleep_greek <- post$sleep_Sat[po...
checkInputVars <- function (normalizescheme, normalclasswise, replaceNA, replaceclasswise, orglabellvls) { errors <- vector() if (!any(normalizescheme == c('none','ztransform', 'iqr', 'sumone'))| length(normalizescheme) != 1) { errors[length(errors) + 1] <- 3 } if ((!any(normalclasswise == orglabel...
/R/check.r
no_license
MATA62N/LVQTools
R
false
false
16,076
r
checkInputVars <- function (normalizescheme, normalclasswise, replaceNA, replaceclasswise, orglabellvls) { errors <- vector() if (!any(normalizescheme == c('none','ztransform', 'iqr', 'sumone'))| length(normalizescheme) != 1) { errors[length(errors) + 1] <- 3 } if ((!any(normalclasswise == orglabel...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/profile_functions.R \name{edit_profile} \alias{edit_profile} \title{Edit your profile function} \usage{ edit_profile() } \description{ Edit your profile function }
/man/edit_profile.Rd
no_license
Giappo/jap
R
false
true
242
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/profile_functions.R \name{edit_profile} \alias{edit_profile} \title{Edit your profile function} \usage{ edit_profile() } \description{ Edit your profile function }
#' Generate a PDF field guide using the ALA's field guide generator #' #' @references \url{http://fieldguide.ala.org.au/} #' @param guids character: vector of GUIDs #' @param title string: title to use in the field guide PDF #' @param filename string: filename for the PDF document #' @param overwrite logical: overwri...
/R/fieldguide.R
no_license
fozy81/NBN4R
R
false
false
823
r
#' Generate a PDF field guide using the ALA's field guide generator #' #' @references \url{http://fieldguide.ala.org.au/} #' @param guids character: vector of GUIDs #' @param title string: title to use in the field guide PDF #' @param filename string: filename for the PDF document #' @param overwrite logical: overwri...
stsp<-function(data,Ntimesteps,Q) # Function to compute the space time separation for a data set # S=stsp(data,Ntimesteps,Q) # data - data set # Ntimesteps - number of time lags # Q a row vector of quartiles, e.g. [25 50 95] to get 25th, median # and 95th seperations { N<-length(data) S=vector() for (i in 1:Ntimesteps)...
/Hailiang-Du/stsp.R
no_license
JUJUup/SummerSchool2021_MLAS
R
false
false
404
r
stsp<-function(data,Ntimesteps,Q) # Function to compute the space time separation for a data set # S=stsp(data,Ntimesteps,Q) # data - data set # Ntimesteps - number of time lags # Q a row vector of quartiles, e.g. [25 50 95] to get 25th, median # and 95th seperations { N<-length(data) S=vector() for (i in 1:Ntimesteps)...
### R code from vignette source 'caper.rnw' ### Encoding: UTF-8 ################################################### ### code chunk number 1: setup ################################################### library(caper) ## whilst code is being tested, load most recent versions from the pkg repository for(f in dir('../../...
/inst/doc/caper.R
no_license
cran/caper
R
false
false
32,542
r
### R code from vignette source 'caper.rnw' ### Encoding: UTF-8 ################################################### ### code chunk number 1: setup ################################################### library(caper) ## whilst code is being tested, load most recent versions from the pkg repository for(f in dir('../../...
# Find all wards within Zambia -------------------------------------------- # Shape files of wards in Zambia are a bit messy, so constructing a lookup table of province, district, # constituencies, wards, and polling places # Laura Hughes, lhughes@usaid.gov, USAID | GeoCenter # 7 July 2017 # procedure ------------...
/ZMB_find_wards.R
permissive
tessam30/Zambia
R
false
false
4,144
r
# Find all wards within Zambia -------------------------------------------- # Shape files of wards in Zambia are a bit messy, so constructing a lookup table of province, district, # constituencies, wards, and polling places # Laura Hughes, lhughes@usaid.gov, USAID | GeoCenter # 7 July 2017 # procedure ------------...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/getPost.R \name{getPost} \alias{getPost} \title{Extract information about a public Facebook post} \usage{ getPost(post, token, n = 500, comments = TRUE, likes = TRUE, n.likes = n, n.comments = n) } \arguments{ \item{post}{A post ID} \item{...
/Rfacebook/man/getPost.Rd
no_license
ashgreat/Rfacebook
R
false
true
1,993
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/getPost.R \name{getPost} \alias{getPost} \title{Extract information about a public Facebook post} \usage{ getPost(post, token, n = 500, comments = TRUE, likes = TRUE, n.likes = n, n.comments = n) } \arguments{ \item{post}{A post ID} \item{...
### rna_seq_featureCounter.R ### Laura M. Carroll ### April 20, 2019 ### input: bam files of mapped reads, saf file output by gff2saf.py script # uncomment to install Rsubread if necessary if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("Rsubread", version = "...
/rna_seq_featureCounter.R
no_license
alexarcohn/salmonella_rnaseq
R
false
false
11,521
r
### rna_seq_featureCounter.R ### Laura M. Carroll ### April 20, 2019 ### input: bam files of mapped reads, saf file output by gff2saf.py script # uncomment to install Rsubread if necessary if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("Rsubread", version = "...
# Copyright 2019 Observational Health Data Sciences and Informatics # # This file is part of aspirin365 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/l...
/aspirin365/R/CohortMethod.R
permissive
rlawodud3920/CDM-Rpackage-2020
R
false
false
11,679
r
# Copyright 2019 Observational Health Data Sciences and Informatics # # This file is part of aspirin365 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/l...
data = read.csv("all.csv") attach(data) gap = dem_pct-gop_pct fit = glm(gap ~ gdp_pct * incumbent * relec) fit newdata = data.frame(gdp_pct=c(2.43), incumbent=c(0), relec=c(FALSE)) predict(fit, newdata) pcts = seq(-5,5,by=0.1) hypdata = data.frame(gdp_pct=pcts, incumbent=rep(0,101), relec=rep(FALSE,101)) predicted = pr...
/bayesian-president/data/elections/elec.R
no_license
CoryMcCartan/election-2016
R
false
false
356
r
data = read.csv("all.csv") attach(data) gap = dem_pct-gop_pct fit = glm(gap ~ gdp_pct * incumbent * relec) fit newdata = data.frame(gdp_pct=c(2.43), incumbent=c(0), relec=c(FALSE)) predict(fit, newdata) pcts = seq(-5,5,by=0.1) hypdata = data.frame(gdp_pct=pcts, incumbent=rep(0,101), relec=rep(FALSE,101)) predicted = pr...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/RcppExports.R \name{optim_Ridge} \alias{optim_Ridge} \title{find optimized solution for ObjectRidge function} \usage{ optim_Ridge(theta, X, y, family, r) } \arguments{ \item{theta}{vector store our optimized result} \item{X}{high dimensional...
/man/optim_Ridge.Rd
permissive
aahilgert/myTridge
R
false
true
521
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/RcppExports.R \name{optim_Ridge} \alias{optim_Ridge} \title{find optimized solution for ObjectRidge function} \usage{ optim_Ridge(theta, X, y, family, r) } \arguments{ \item{theta}{vector store our optimized result} \item{X}{high dimensional...
## Date: 4 October, 2022 ## Author: Drew Neavin ## Reason: RNA velocity on iPSC village samples for pseudotime following the Allevin tutorial https://combine-lab.github.io/alevin-tutorial/2020/alevin-velocity/ library(Biostrings) library(BSgenome) library(eisaR) library(GenomicFeatures) library(SummarizedExperiment) l...
/scripts/hiPSC_village_3_lines/RNA_Velocity_Pseudotime/scVelo_preprocess.R
no_license
powellgenomicslab/iPSC_Village_Publication
R
false
false
3,182
r
## Date: 4 October, 2022 ## Author: Drew Neavin ## Reason: RNA velocity on iPSC village samples for pseudotime following the Allevin tutorial https://combine-lab.github.io/alevin-tutorial/2020/alevin-velocity/ library(Biostrings) library(BSgenome) library(eisaR) library(GenomicFeatures) library(SummarizedExperiment) l...
library(testthat) library(RsNlme) test_package("RsNlme")
/RsNlme/tests/run_test.r
no_license
phxnlmedev/rpackages
R
false
false
58
r
library(testthat) library(RsNlme) test_package("RsNlme")
library(data.table) library(prophet) library(dplyr) library(ggpubr) library(Metrics) dt=data.table(read.csv('sample_fb.csv')) offers=data.table(read.csv('offers.csv')) dt$Day=as.Date(as.character(dt$Day)) offers$Date=as.Date(as.character(offers$Date)) names(dt)=c('ds','y') dt= dt[order(ds),] ############# Daily Fore...
/Forecast_GAM_v1.r
no_license
saracmbr/Code_Demo
R
false
false
2,669
r
library(data.table) library(prophet) library(dplyr) library(ggpubr) library(Metrics) dt=data.table(read.csv('sample_fb.csv')) offers=data.table(read.csv('offers.csv')) dt$Day=as.Date(as.character(dt$Day)) offers$Date=as.Date(as.character(offers$Date)) names(dt)=c('ds','y') dt= dt[order(ds),] ############# Daily Fore...
## ----setup, include = FALSE---------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----ttest_ex1, eval=FALSE----------------------------------------------- # # load the bain package which includes the simulated sesamesim data set # library(bain) # # ...
/data/genthat_extracted_code/bain/vignettes/Introduction_to_bain.R
no_license
surayaaramli/typeRrh
R
false
false
29,011
r
## ----setup, include = FALSE---------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----ttest_ex1, eval=FALSE----------------------------------------------- # # load the bain package which includes the simulated sesamesim data set # library(bain) # # ...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/basis-funs.R \name{basis} \alias{basis} \title{Basis expansions for smooths} \usage{ basis(smooth, data, knots = NULL, constraints = FALSE, ...) } \arguments{ \item{smooth}{a smooth specification, the result of a call to one of \code{\link[mg...
/man/basis.Rd
permissive
romainfrancois/gratia
R
false
true
1,503
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/basis-funs.R \name{basis} \alias{basis} \title{Basis expansions for smooths} \usage{ basis(smooth, data, knots = NULL, constraints = FALSE, ...) } \arguments{ \item{smooth}{a smooth specification, the result of a call to one of \code{\link[mg...
rm(list=ls()) datatable<-read.table("household_power_consumption.txt", sep=";", nrows= 2075260, header=TRUE, quote= "", strip.white=TRUE, stringsAsFactors = FALSE, ...
/plot2.R
no_license
ozkuran/ExData_Plotting1
R
false
false
762
r
rm(list=ls()) datatable<-read.table("household_power_consumption.txt", sep=";", nrows= 2075260, header=TRUE, quote= "", strip.white=TRUE, stringsAsFactors = FALSE, ...
# Code for computing likelihoods and posteriors ## Defining a helper function # This function creates a data frame will all possible choices and probabilities #associated with them, and matches it with participants' responses. This is used for computing likelihoods. get_function <- here::here("bayesian_modeling", "...
/01_diversity_analyses/bayesian_modeling/compute_likelihoods_posteriors.R
no_license
nyu-cdsc/diversity
R
false
false
2,915
r
# Code for computing likelihoods and posteriors ## Defining a helper function # This function creates a data frame will all possible choices and probabilities #associated with them, and matches it with participants' responses. This is used for computing likelihoods. get_function <- here::here("bayesian_modeling", "...
# program: spuRs/resources/scripts/quad1.r # find the zeros of a2*x^2 + a1*x + a0 = 0 # clear the workspace rm(list=ls()) # input a2 <- 1 a1 <- 4 a0 <- 2 # calculation root1 <- (-a1 + sqrt(a1^2 - 4*a2*a0))/(2*a2) root2 <- (-a1 - sqrt(a1^2 - 4*a2*a0))/(2*a2) # output show(c(root1, root2))
/R Tutorials/Book spuRs/scripts/quad1.r
no_license
chengjun/Research
R
false
false
293
r
# program: spuRs/resources/scripts/quad1.r # find the zeros of a2*x^2 + a1*x + a0 = 0 # clear the workspace rm(list=ls()) # input a2 <- 1 a1 <- 4 a0 <- 2 # calculation root1 <- (-a1 + sqrt(a1^2 - 4*a2*a0))/(2*a2) root2 <- (-a1 - sqrt(a1^2 - 4*a2*a0))/(2*a2) # output show(c(root1, root2))
log.val = function(beta, Xtst) { #################### INIT Xtst = as.matrix(Xtst) beta = as.matrix(beta) if(ncol(beta)>nrow(Xtst)) {Xtst = as.matrix(cbind(rep(1,nrow(Xtst)),Xtst))} ### then add intercept if necessary prob = matrix(0,nrow=nrow(Xtst),ncol=2) colnames(prob) = c("w1","w2") ...
/TP4/fonctions du rapport/log.val.R
no_license
mdepuydt/SY09
R
false
false
566
r
log.val = function(beta, Xtst) { #################### INIT Xtst = as.matrix(Xtst) beta = as.matrix(beta) if(ncol(beta)>nrow(Xtst)) {Xtst = as.matrix(cbind(rep(1,nrow(Xtst)),Xtst))} ### then add intercept if necessary prob = matrix(0,nrow=nrow(Xtst),ncol=2) colnames(prob) = c("w1","w2") ...
testlist <- list(x = structure(c(1.35248279137152e-309, 1.98730118526674e-168, 5.28313590379074e-312), .Dim = c(3L, 1L))) result <- do.call(bravo:::colSumSq_matrix,testlist) str(result)
/bravo/inst/testfiles/colSumSq_matrix/libFuzzer_colSumSq_matrix/colSumSq_matrix_valgrind_files/1609959947-test.R
no_license
akhikolla/updated-only-Issues
R
false
false
186
r
testlist <- list(x = structure(c(1.35248279137152e-309, 1.98730118526674e-168, 5.28313590379074e-312), .Dim = c(3L, 1L))) result <- do.call(bravo:::colSumSq_matrix,testlist) str(result)
testlist <- list(doy = numeric(0), latitude = numeric(0), temp = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) result <- do.call(meteor:::ET0_ThornthwaiteWilmott,testlist) str(result)
/meteor/inst/testfiles/ET0_ThornthwaiteWilmott/libFuzzer_ET0_ThornthwaiteWilmott/ET0_ThornthwaiteWilmott_valgrind_files/1612735241-test.R
no_license
akhikolla/updatedatatype-list3
R
false
false
207
r
testlist <- list(doy = numeric(0), latitude = numeric(0), temp = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) result <- do.call(meteor:::ET0_ThornthwaiteWilmott,testlist) str(result)
Time <- c(11048,11262,11504,12418) Pipeline <- c(0.45,0.45,0.45,0.37,0.44,0.43,0.43,0.37,0.45, 0.45,0.45,0.40,0.43,0.42,0.43,0.43,0.42,0.41, 0.41,0.35,0.41,0.42,0.42,0.42,0.46,0.46,0.46, 0.43,0.43,0.42,0.43,0.42,0.45,0.45,0.45,0.44, 0.45,0.44,0.45,0.44,0.44,0.43,...
/Complex/Complex_Model1_Lognormal_Drive.r
no_license
ISUCyclone/Pipelines
R
false
false
1,357
r
Time <- c(11048,11262,11504,12418) Pipeline <- c(0.45,0.45,0.45,0.37,0.44,0.43,0.43,0.37,0.45, 0.45,0.45,0.40,0.43,0.42,0.43,0.43,0.42,0.41, 0.41,0.35,0.41,0.42,0.42,0.42,0.46,0.46,0.46, 0.43,0.43,0.42,0.43,0.42,0.45,0.45,0.45,0.44, 0.45,0.44,0.45,0.44,0.44,0.43,...
plot4 <- function(){ library("stringr"); library("dplyr"); data <- read.csv("household_power_consumption.txt", sep = ";", header = TRUE, stringsAsFactors=FALSE, na.strings = "?"); data$Date <- as.Date(data$Date, "%d/%m/%Y"); filtered <- filter(data, Date == "2007-02-01" | Date == "2007-02-02"); ...
/plot4.R
no_license
23Mbennett/exploratory-data-anlaysis-assignment-1
R
false
false
1,258
r
plot4 <- function(){ library("stringr"); library("dplyr"); data <- read.csv("household_power_consumption.txt", sep = ";", header = TRUE, stringsAsFactors=FALSE, na.strings = "?"); data$Date <- as.Date(data$Date, "%d/%m/%Y"); filtered <- filter(data, Date == "2007-02-01" | Date == "2007-02-02"); ...