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
#' Calculate mitigation costs #' #' Calculate mitigation costs #' #' #' @param data quitte object #' @param scenBau baseline scenario name #' @param scenPol policy scenario name #' @param yearFrom the startyear #' @param yearTo the endyear #' @param nameVar Name of the variable containing consumption. Defaults to #' "C...
/R/calcMitigationCost.R
no_license
0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q/quitte
R
false
false
2,346
r
#' Calculate mitigation costs #' #' Calculate mitigation costs #' #' #' @param data quitte object #' @param scenBau baseline scenario name #' @param scenPol policy scenario name #' @param yearFrom the startyear #' @param yearTo the endyear #' @param nameVar Name of the variable containing consumption. Defaults to #' "C...
rm(list=ls()) set.seed(75) xVec<-sample(0:9,size=10,replace=T) tmpFn1 <- function(x) { x^(1:length(x)) } tmpFn2 <- function(x) { n <- length(x) (x^(1:n))/(1:n) } tmpFn <- function(x) { n<-length(x)-2 (x[1:n] + x[2:(n+1)] + x[3:(n+2)])/3 } tmpFn(c(1:5,6:1)) tmpFn <- function(x) { ifelse(x < 0, ...
/Ex3Functions.R
no_license
KrishnaGMohan/RExercises
R
false
false
3,509
r
rm(list=ls()) set.seed(75) xVec<-sample(0:9,size=10,replace=T) tmpFn1 <- function(x) { x^(1:length(x)) } tmpFn2 <- function(x) { n <- length(x) (x^(1:n))/(1:n) } tmpFn <- function(x) { n<-length(x)-2 (x[1:n] + x[2:(n+1)] + x[3:(n+2)])/3 } tmpFn(c(1:5,6:1)) tmpFn <- function(x) { ifelse(x < 0, ...
# test_igraph_inv.R # Created by Disa Mhembere on 2013-12-31. # Email: disa@jhu.edu # Copyright (c) 2013. All rights reserved. require(igraph) require(argparse) parser <- ArgumentParser(description="Run same invariants as MROCP on igraphs") parser$add_argument("gfn", help="The graph file name") parser$add_argument("...
/MR-OCP/MROCPdjango/computation/tests/test_igraph_inv.R
permissive
gkiar/ndgrutedb
R
false
false
1,387
r
# test_igraph_inv.R # Created by Disa Mhembere on 2013-12-31. # Email: disa@jhu.edu # Copyright (c) 2013. All rights reserved. require(igraph) require(argparse) parser <- ArgumentParser(description="Run same invariants as MROCP on igraphs") parser$add_argument("gfn", help="The graph file name") parser$add_argument("...
#' Submit an expression to be evaluated to multiple jobs. #' @param expr An expression to be passed to Slurm. #' @template slurm #' @template job_name-tmp_path #' @template sbatch_opt #' @template rscript_opt #' @template njobs #' @return A list of length `njobs`. #' @export Slurm_EvalQ <- function( expr, njobs ...
/R/Slurm_EvalQ.R
permissive
josezea/slurmR
R
false
false
2,899
r
#' Submit an expression to be evaluated to multiple jobs. #' @param expr An expression to be passed to Slurm. #' @template slurm #' @template job_name-tmp_path #' @template sbatch_opt #' @template rscript_opt #' @template njobs #' @return A list of length `njobs`. #' @export Slurm_EvalQ <- function( expr, njobs ...
##' Additional Themes and Theme Components for 'ggplot2' based on OCHA graphic styles ##' ##' A compilation of extra themes and theme components for 'ggplot2' ##' The core theme: `theme_ocha` ##' ##' ##' @name ochathemes-package ##' @aliases ochathemes ##' @docType package ##' @author \email{mail@ahmadoudicko.com} ##'...
/R/ochathemes-package.R
permissive
mmusori/ochathemes
R
false
false
344
r
##' Additional Themes and Theme Components for 'ggplot2' based on OCHA graphic styles ##' ##' A compilation of extra themes and theme components for 'ggplot2' ##' The core theme: `theme_ocha` ##' ##' ##' @name ochathemes-package ##' @aliases ochathemes ##' @docType package ##' @author \email{mail@ahmadoudicko.com} ##'...
miRDB <- function(searchBox = NA, searchType = c("miRNA", "gene"), Species = c("Human", "Mouse")){ suppressWarnings(suppressPackageStartupMessages({ library(httr) library(curl) library(rlist) library(tidyverse) library(rvest)} )) headers <- c('Accept'='text/html,application/xhtml+xml,applicati...
/R/miRDB.R
no_license
shitiezhu/BioMedR
R
false
false
1,530
r
miRDB <- function(searchBox = NA, searchType = c("miRNA", "gene"), Species = c("Human", "Mouse")){ suppressWarnings(suppressPackageStartupMessages({ library(httr) library(curl) library(rlist) library(tidyverse) library(rvest)} )) headers <- c('Accept'='text/html,application/xhtml+xml,applicati...
#install.packages('RSQLite') library(RSQLite) #lier ce script et nettoyage_equipes_1-7.r bd_cours <- read.csv2('bd_cours_1-7.csv', header = T) bd_liens <- read.csv2('bd_liens_1-7.csv', header = T) bd_etudiants <- read.csv2('bd_etudiants_1-7.csv', header = T) tables.db <- dbConnect(SQLite(), dbname="tables.db") #cre...
/injection_données.R
no_license
elysepaquette/lesreseaux
R
false
false
2,642
r
#install.packages('RSQLite') library(RSQLite) #lier ce script et nettoyage_equipes_1-7.r bd_cours <- read.csv2('bd_cours_1-7.csv', header = T) bd_liens <- read.csv2('bd_liens_1-7.csv', header = T) bd_etudiants <- read.csv2('bd_etudiants_1-7.csv', header = T) tables.db <- dbConnect(SQLite(), dbname="tables.db") #cre...
# Plot Functionality for package bpwpm #------------------------------------------------------------------------------- #' Generic bpwpm plotting #' #' Once a bpwpm has been run using the function \code{\link{bpwpm_gibbs}}, the #' chains can be plotted and hence evaluated. This generic function builds sets #' of plots...
/R/plot_funcs.R
no_license
PaoloLuciano/bpwpm
R
false
false
13,027
r
# Plot Functionality for package bpwpm #------------------------------------------------------------------------------- #' Generic bpwpm plotting #' #' Once a bpwpm has been run using the function \code{\link{bpwpm_gibbs}}, the #' chains can be plotted and hence evaluated. This generic function builds sets #' of plots...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/grcm38_tx2gene.R \docType{data} \name{grcm38_tx2gene} \alias{grcm38_tx2gene} \title{Mouse transcripts to genes} \format{An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 129826 rows and 2 columns.} \source{ \...
/man/grcm38_tx2gene.Rd
no_license
aaronwolen/annotables
R
false
true
652
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/grcm38_tx2gene.R \docType{data} \name{grcm38_tx2gene} \alias{grcm38_tx2gene} \title{Mouse transcripts to genes} \format{An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 129826 rows and 2 columns.} \source{ \...
#' Produce a calibration plot for a set of predicted probabilities for a binary classifier. #' @export #' @import ggplot2 #' @import data.table #' @importFrom patchwork plot_layout #' @importFrom Hmisc binconf #' #' @param form A formula where the left-hand side is the variable representing the observed outcome, 0 or 1...
/R/calib_plot.R
no_license
gweissman/gmish
R
false
false
3,508
r
#' Produce a calibration plot for a set of predicted probabilities for a binary classifier. #' @export #' @import ggplot2 #' @import data.table #' @importFrom patchwork plot_layout #' @importFrom Hmisc binconf #' #' @param form A formula where the left-hand side is the variable representing the observed outcome, 0 or 1...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/fitted.FPCAder.R \name{fitted.FPCAder} \alias{fitted.FPCAder} \title{Fitted functional sample from FPCAder object} \usage{ \method{fitted}{FPCAder}(object, K = NULL, ...) } \arguments{ \item{object}{A object of class FPCA returned by the func...
/man/fitted.FPCAder.Rd
no_license
rogersguo/tPACE
R
false
true
1,252
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/fitted.FPCAder.R \name{fitted.FPCAder} \alias{fitted.FPCAder} \title{Fitted functional sample from FPCAder object} \usage{ \method{fitted}{FPCAder}(object, K = NULL, ...) } \arguments{ \item{object}{A object of class FPCA returned by the func...
## Read in the data # Data are at http://www.stat.columbia.edu/~gelman/arm/examples/arsenic library("arm") wells <- read.table ("~/Dropbox/Work/Harvard/Wolkovich Lab/Gelman_Hill/ARM_Data/arsenic/wells.dat") attach.all (wells) ## Histogram on distance (Figure 5.8) hist (dist, breaks=seq(0,10+max(dist[!is.na(...
/gelmanhill_stuff/Book_Codes/Ch.5/5.4_Logistic regression_wells in Bangladesh.R
no_license
lizzieinvancouver/gelmanhill
R
false
false
3,600
r
## Read in the data # Data are at http://www.stat.columbia.edu/~gelman/arm/examples/arsenic library("arm") wells <- read.table ("~/Dropbox/Work/Harvard/Wolkovich Lab/Gelman_Hill/ARM_Data/arsenic/wells.dat") attach.all (wells) ## Histogram on distance (Figure 5.8) hist (dist, breaks=seq(0,10+max(dist[!is.na(...
## Test file for the IRSDataLoader object library(QFFixedIncome) testIRSDataLoader <- function() { # test bad inputss loaderSample <- IRSDataLoader() irsSample <- GenericIRS() irsSample$setDefault(tenor = "5y") shouldBomb(loaderSample$getSpreads()) shouldBomb(loaderSample$...
/R/src/QFFixedIncome/tests/testIRSDataLoader.R
no_license
rsheftel/ratel
R
false
false
5,049
r
## Test file for the IRSDataLoader object library(QFFixedIncome) testIRSDataLoader <- function() { # test bad inputss loaderSample <- IRSDataLoader() irsSample <- GenericIRS() irsSample$setDefault(tenor = "5y") shouldBomb(loaderSample$getSpreads()) shouldBomb(loaderSample$...
#' getVariantsColors #' #' @description #' #' Given the reference and alternative for a set of variants, assigns a color #' to each of them #' #' @details #' #' The function creates an nucleotide substitution identifier with for each #' variant and uses it to query the color.table lookup table. If color.table ...
/R/getVariantsColors.R
no_license
jing-wan/karyoploteR
R
false
false
3,151
r
#' getVariantsColors #' #' @description #' #' Given the reference and alternative for a set of variants, assigns a color #' to each of them #' #' @details #' #' The function creates an nucleotide substitution identifier with for each #' variant and uses it to query the color.table lookup table. If color.table ...
\name{max.subtree.rfsrc} \alias{max.subtree.rfsrc} \alias{max.subtree} \title{Acquire Maximal Subtree Information} \description{ Extract maximal subtree information from a RF-SRC object. Used for variable selection and identifying interactions between variables. } \usage{\method{max.subtree}{rfsrc}(object, m...
/man/max.subtree.rfsrc.Rd
no_license
nkuwangkai/randomForestSRC
R
false
false
6,560
rd
\name{max.subtree.rfsrc} \alias{max.subtree.rfsrc} \alias{max.subtree} \title{Acquire Maximal Subtree Information} \description{ Extract maximal subtree information from a RF-SRC object. Used for variable selection and identifying interactions between variables. } \usage{\method{max.subtree}{rfsrc}(object, m...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/link_time_performance_integrated.R \name{link_time_performance_integrated} \alias{link_time_performance_integrated} \title{Integration of link time performance} \usage{ link_time_performance_integrated(flow, t0, capacity, alpha = 0.15, beta =...
/man/link_time_performance_integrated.Rd
no_license
douglascm/trafficr
R
false
true
769
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/link_time_performance_integrated.R \name{link_time_performance_integrated} \alias{link_time_performance_integrated} \title{Integration of link time performance} \usage{ link_time_performance_integrated(flow, t0, capacity, alpha = 0.15, beta =...
# # This is the server logic of a Shiny web application. You can run the # application by clicking 'Run App' above. # # Find out more about building applications with Shiny here: # # http://shiny.rstudio.com/ # library(shiny) function(input, output, session) { # input$date and others are Date...
/server.R
no_license
HossamMHassan/App
R
false
false
803
r
# # This is the server logic of a Shiny web application. You can run the # application by clicking 'Run App' above. # # Find out more about building applications with Shiny here: # # http://shiny.rstudio.com/ # library(shiny) function(input, output, session) { # input$date and others are Date...
test_that("rws_connect", { expect_error( rws_connect(":memory:", exists = TRUE), "File ':memory:' must already exist." ) conn <- rws_connect(":memory:") expect_true(vld_sqlite_conn(conn, connected = TRUE)) rws_disconnect(conn) expect_true(vld_sqlite_conn(conn, connected = FALSE)) })
/tests/testthat/test-connection.R
permissive
poissonconsulting/readwritesqlite
R
false
false
304
r
test_that("rws_connect", { expect_error( rws_connect(":memory:", exists = TRUE), "File ':memory:' must already exist." ) conn <- rws_connect(":memory:") expect_true(vld_sqlite_conn(conn, connected = TRUE)) rws_disconnect(conn) expect_true(vld_sqlite_conn(conn, connected = FALSE)) })
#Plot 3 require(lubridate) require(ggplot2) #Download and read files if(!(file.exists("Source_Classification_Code.rds"))){ download.file("http://d396qusza40orc.cloudfront.net/exdata%2Fdata%2FNEI_data.zip", "dataset.zip") unzip("dataset.zip") file.remove("dataset.zip") } #Variable creation and general cleanup S...
/plot3.R
no_license
joaoclemencio/EDA-Course-Project-2
R
false
false
1,501
r
#Plot 3 require(lubridate) require(ggplot2) #Download and read files if(!(file.exists("Source_Classification_Code.rds"))){ download.file("http://d396qusza40orc.cloudfront.net/exdata%2Fdata%2FNEI_data.zip", "dataset.zip") unzip("dataset.zip") file.remove("dataset.zip") } #Variable creation and general cleanup S...
## ---------- dataprep.R ----------- ## # # # fastaconc # # df2fasta # # d.phy2df # # # ## --------------------------------- ## ## ------------------------------------...
/R/dataprep.R
no_license
cran/EnvNJ
R
false
false
4,428
r
## ---------- dataprep.R ----------- ## # # # fastaconc # # df2fasta # # d.phy2df # # # ## --------------------------------- ## ## ------------------------------------...
##Loading and reading the file dataFile <- "./household_power_consumption.txt" data <- read.table(dataFile, header=TRUE, sep=";", stringsAsFactors=FALSE, dec=".") subSetData <- data[data$Date %in% c("1/2/2007","2/2/2007") ,] ##plotting graph 1 #str(subSetData) globalActivePower <- as.numeric(subSetData$Global_active_po...
/plot1.R
no_license
kellywale/Exploratorydataplotting
R
false
false
477
r
##Loading and reading the file dataFile <- "./household_power_consumption.txt" data <- read.table(dataFile, header=TRUE, sep=";", stringsAsFactors=FALSE, dec=".") subSetData <- data[data$Date %in% c("1/2/2007","2/2/2007") ,] ##plotting graph 1 #str(subSetData) globalActivePower <- as.numeric(subSetData$Global_active_po...
### 6.4 # [for the sake of practice, here I use a different approach than in the previous exercise. # this approach is more general as it is not limited to two states as before] # random walk parameters: p <- .3 q <- .3 r <- .4 p1<- .2 q1<- .2 r1<- .6 ...
/hw2/hw2_6.4_sb.R
no_license
vhurtadol/POLI574
R
false
false
1,820
r
### 6.4 # [for the sake of practice, here I use a different approach than in the previous exercise. # this approach is more general as it is not limited to two states as before] # random walk parameters: p <- .3 q <- .3 r <- .4 p1<- .2 q1<- .2 r1<- .6 ...
library(plotrix) library(readxl) pob<-read_xlsx("azcapob1.xlsx") attach(pob) pob1<-pob[,-1] pob2<-t(pob1) colnames(pob2)<- c("40-44", "45 a 49", "50 a 54", "55 a 59") pob2 barp(pob2, names.arg = colnames(pob2), cex.axis = 0.7, col=rainbow(2), cylindrical = TRUE, ylim = c(0,19000), shadow = FALSE, staxx ...
/Rstudioazcapotzalco/poblacion/R/azcagrafo3.R
no_license
davidlechuga/OPCD
R
false
false
635
r
library(plotrix) library(readxl) pob<-read_xlsx("azcapob1.xlsx") attach(pob) pob1<-pob[,-1] pob2<-t(pob1) colnames(pob2)<- c("40-44", "45 a 49", "50 a 54", "55 a 59") pob2 barp(pob2, names.arg = colnames(pob2), cex.axis = 0.7, col=rainbow(2), cylindrical = TRUE, ylim = c(0,19000), shadow = FALSE, staxx ...
# Platform Repository Service # # Platform Repository Service - Sage Bionetworks Platform # # The version of the OpenAPI document: develop-SNAPSHOT # Contact: thomas.yu@sagebionetworks.org # Generated by: https://openapi-generator.tech #' @docType class #' @title SubmissionStatusEnum #' #' @description SubmissionStat...
/R/submission_status_enum.R
no_license
thomasyu888/synr-sdk-client
R
false
false
1,905
r
# Platform Repository Service # # Platform Repository Service - Sage Bionetworks Platform # # The version of the OpenAPI document: develop-SNAPSHOT # Contact: thomas.yu@sagebionetworks.org # Generated by: https://openapi-generator.tech #' @docType class #' @title SubmissionStatusEnum #' #' @description SubmissionStat...
## Copyright 2013-2015 Stefan Widgren and Maria Noremark, ## National Veterinary Institute, Sweden ## ## Licensed under the EUPL, Version 1.1 or - as soon they ## will be approved by the European Commission - subsequent ## versions of the EUPL (the "Licence"); ## You may not use this work except in compliance with the ...
/EpiContactTrace/R/in-degree.r
no_license
ingted/R-Examples
R
false
false
7,556
r
## Copyright 2013-2015 Stefan Widgren and Maria Noremark, ## National Veterinary Institute, Sweden ## ## Licensed under the EUPL, Version 1.1 or - as soon they ## will be approved by the European Commission - subsequent ## versions of the EUPL (the "Licence"); ## You may not use this work except in compliance with the ...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/drug_targets_node_parser.R \name{parse_drug_targets_polypeptides_pfams} \alias{parse_drug_targets_polypeptides_pfams} \title{Extracts the drug targets polypeptides pfams element and return data as data frame.} \usage{ parse_drug_targets_poly...
/man/parse_drug_targets_polypeptides_pfams.Rd
no_license
Sparklingredstar/dbparser
R
false
true
2,606
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/drug_targets_node_parser.R \name{parse_drug_targets_polypeptides_pfams} \alias{parse_drug_targets_polypeptides_pfams} \title{Extracts the drug targets polypeptides pfams element and return data as data frame.} \usage{ parse_drug_targets_poly...
`LDuncan` <- function(anova,which="",conf.level=0.95) UseMethod("LDuncan")
/R/LDuncan.R
no_license
cran/laercio
R
false
false
75
r
`LDuncan` <- function(anova,which="",conf.level=0.95) UseMethod("LDuncan")
##' Calculate Mohn's Rho values for select quantities ##' ##' Function calculates: ##' (1) a rho value for the ending year for each retrospective relative to the reference model ##' as in Mohn (1999), ##' (2) a "Wood's Hole Mohn's Rho", which is a rho value averaged across all years for each ##' retrospective rel...
/R/SSmohnsrho.R
no_license
cran/r4ss
R
false
false
6,555
r
##' Calculate Mohn's Rho values for select quantities ##' ##' Function calculates: ##' (1) a rho value for the ending year for each retrospective relative to the reference model ##' as in Mohn (1999), ##' (2) a "Wood's Hole Mohn's Rho", which is a rho value averaged across all years for each ##' retrospective rel...
#' @export Ops.optmatch.dlist <- function (e1, e2=NULL) { ok <- switch(.Generic, "%%" = , "%/%" = FALSE, TRUE) if (!ok) { warning(.Generic, " not meaningful for matching distances; returning 1st arg") return(e1) } unary <- nargs() == 1 if (nchar(.Method[1])) { rn1 <- attr(e1, ...
/R/Ops.optmatch.dlist.R
permissive
markmfredrickson/optmatch
R
false
false
4,573
r
#' @export Ops.optmatch.dlist <- function (e1, e2=NULL) { ok <- switch(.Generic, "%%" = , "%/%" = FALSE, TRUE) if (!ok) { warning(.Generic, " not meaningful for matching distances; returning 1st arg") return(e1) } unary <- nargs() == 1 if (nchar(.Method[1])) { rn1 <- attr(e1, ...
genlogCompleteStartValues <- function(data, timeVar = 1, yVar = 2, phaseVar = NULL, baselineMeasurements = NULL, ### Was nA y...
/R/genlogCompleteStartValues.R
no_license
DBoegner/userfriendlyscience
R
false
false
7,274
r
genlogCompleteStartValues <- function(data, timeVar = 1, yVar = 2, phaseVar = NULL, baselineMeasurements = NULL, ### Was nA y...
#' combine two gg_partial objects #' #' @description #' The \code{combine.gg_partial} function assumes the two \code{\link{gg_partial}} #' objects were generated from the same \code{\link[randomForestSRC]{rfsrc}} #' object. So, the function joins along the \code{\link{gg_partial}} list item #' names (one per partial...
/R/combine.gg_partial.R
no_license
mingrisch/ggRandomForests
R
false
false
3,600
r
#' combine two gg_partial objects #' #' @description #' The \code{combine.gg_partial} function assumes the two \code{\link{gg_partial}} #' objects were generated from the same \code{\link[randomForestSRC]{rfsrc}} #' object. So, the function joins along the \code{\link{gg_partial}} list item #' names (one per partial...
library(shiny) library(shinydashboard) library(purrr) server <- function(input, output, session) { ########################################################################### # Settings ########################################################################### i18n <- reactive({ selected <- input$selected...
/server.R
permissive
pablo-vivas/ProbabilityDistributionsViewer
R
false
false
5,625
r
library(shiny) library(shinydashboard) library(purrr) server <- function(input, output, session) { ########################################################################### # Settings ########################################################################### i18n <- reactive({ selected <- input$selected...
library(ggplot2movies) library(car) data(movies) attach(movies) View(movies) # przegląd wszystkich danych ls(movies) # lista zmiennnych # zmniejszamy ilość porównywanych danych, ponieważ dla tak dużej ilości porównywanych danych # (58788) hipoteza zerowa będzie niemalże na 100% pewna. Dla możliwości wyciągnięcia wn...
/src/R/RAPORT 2 2.R
permissive
NataliaEwa/AppliedMathematics
R
false
false
6,386
r
library(ggplot2movies) library(car) data(movies) attach(movies) View(movies) # przegląd wszystkich danych ls(movies) # lista zmiennnych # zmniejszamy ilość porównywanych danych, ponieważ dla tak dużej ilości porównywanych danych # (58788) hipoteza zerowa będzie niemalże na 100% pewna. Dla możliwości wyciągnięcia wn...
Sys.setlocale("LC_ALL", "C") setwd("C:\\R\\Analytics Edge") getwd() emails = read.csv("emails.csv", stringsAsFactors=FALSE) str(emails) summary(emails$spam==1) library(tm) library(SnowballC) corpus = Corpus(VectorSource(emails$text)) corpus corpus[[1]] corpus = tm_map(corpus, tolower) corpus = tm_map(corpus, PlainT...
/Week 5 - Text Mining/Asignment 5c/Spam from Ham.R
no_license
AlfonsoCampos/The-Analytics-Edge
R
false
false
3,172
r
Sys.setlocale("LC_ALL", "C") setwd("C:\\R\\Analytics Edge") getwd() emails = read.csv("emails.csv", stringsAsFactors=FALSE) str(emails) summary(emails$spam==1) library(tm) library(SnowballC) corpus = Corpus(VectorSource(emails$text)) corpus corpus[[1]] corpus = tm_map(corpus, tolower) corpus = tm_map(corpus, PlainT...
#Task 1 # Setting up working directory setwd("C:/Users/victor/Desktop/Economics_R_Code") library(tidyverse) library(sf) #Task 2 #Downloaded Counties and equavilent data #Shape file are located in working directory file 'Dataset' of my directory #Task 3 #Reading the nytiowa data set and tidy it up (reuse code form la...
/Scripts/Tran7.R
no_license
VictorTran808/Economics_R_Code
R
false
false
1,247
r
#Task 1 # Setting up working directory setwd("C:/Users/victor/Desktop/Economics_R_Code") library(tidyverse) library(sf) #Task 2 #Downloaded Counties and equavilent data #Shape file are located in working directory file 'Dataset' of my directory #Task 3 #Reading the nytiowa data set and tidy it up (reuse code form la...
#Goncala version riskvalRuns source("powerTests.r") #source("powerTests2.r") #total sample size 10000 Samp <- 10000 #Casamp = n; Cosamp = Samp-n rounds = 10000 disfr = 0.0001 sims <- data.frame() #cat("Ncases Ncontrols AF Risk Power_Log Power_Score Power_Prop Power_Chi Disease_frequency\n") for (Cosamp in c(9000, 80...
/riskValRuns.R
no_license
lankrist/ph_meta-analysis
R
false
false
956
r
#Goncala version riskvalRuns source("powerTests.r") #source("powerTests2.r") #total sample size 10000 Samp <- 10000 #Casamp = n; Cosamp = Samp-n rounds = 10000 disfr = 0.0001 sims <- data.frame() #cat("Ncases Ncontrols AF Risk Power_Log Power_Score Power_Prop Power_Chi Disease_frequency\n") for (Cosamp in c(9000, 80...
#packages installed= data.table, dplyr, formattable, tidyr using function install.packages("") for example install.packages ("tidyr") library(tidyr) library(ggplot2) library(data.table) library(dplyr) library(formattable) library(qwraps2) library(stringr) #Actual.Eco.Site is a column I added to each TerrADat ...
/Unknown Codes remaining in data.R
no_license
bewheeler/AIM_Annual_Report_Code
R
false
false
4,588
r
#packages installed= data.table, dplyr, formattable, tidyr using function install.packages("") for example install.packages ("tidyr") library(tidyr) library(ggplot2) library(data.table) library(dplyr) library(formattable) library(qwraps2) library(stringr) #Actual.Eco.Site is a column I added to each TerrADat ...
plot3<- function() { # read data project_elec<-read.table("household_power_consumption.txt", sep=";",header=TRUE) # convert to numeric project_elec$Sub_metering_1<-as.numeric(project_elec$Sub_metering_1) project_elec$Sub_metering_2<-as.numeric(project_elec$Sub_metering_2) pr...
/plot3.R
no_license
unknowncutename/exploratorydata
R
false
false
1,436
r
plot3<- function() { # read data project_elec<-read.table("household_power_consumption.txt", sep=";",header=TRUE) # convert to numeric project_elec$Sub_metering_1<-as.numeric(project_elec$Sub_metering_1) project_elec$Sub_metering_2<-as.numeric(project_elec$Sub_metering_2) pr...
#' @title Gather spectra from list of spectral data into a tibble object #' @description Gather specta and spectrometer metadata from list into a tibble. #' Spectra and wavenumbers are stored in list-columns. A tibble is an extended #' data frame and each spectrum can contain complex data and metadata that #' are in a ...
/Soil-Predictions-Example/Functions/simplerspec/gather-spc.R
no_license
lusensn/Soil-Predictions-MIR
R
false
false
2,515
r
#' @title Gather spectra from list of spectral data into a tibble object #' @description Gather specta and spectrometer metadata from list into a tibble. #' Spectra and wavenumbers are stored in list-columns. A tibble is an extended #' data frame and each spectrum can contain complex data and metadata that #' are in a ...
LabelPlot<-function(Data,Sel1,Sel2=NULL,col1,col2=NULL,...){ x=Data$Clust d_temp <- stats::dendrapply(stats::as.dendrogram(x,hang=0.02),LabelCols,Sel1,Sel2,col1,col2) graphics::plot(d_temp,nodePar=list(pch=NA),edgePar=list(lwd=2),ylab="Height",font.axis=2,font.lab=2,font=2,...) graphics::axis(side = 2, lw...
/IntClust/R/Labelplot.R
no_license
ingted/R-Examples
R
false
false
331
r
LabelPlot<-function(Data,Sel1,Sel2=NULL,col1,col2=NULL,...){ x=Data$Clust d_temp <- stats::dendrapply(stats::as.dendrogram(x,hang=0.02),LabelCols,Sel1,Sel2,col1,col2) graphics::plot(d_temp,nodePar=list(pch=NA),edgePar=list(lwd=2),ylab="Height",font.axis=2,font.lab=2,font=2,...) graphics::axis(side = 2, lw...
# Teresita M. Porter, Sept. 9, 2019 library(vegan) library(reshape2) library(gridExtra) library(grid) library(ggplot2) library(plyr) library(data.table) library("car") library(stringr) library("ggpubr") # Read infile A<-read.table(file="matrix.csv", head=TRUE, sep=",") # Select phylum Arthropoda only B<-A[A$Phylum==...
/scripts/Fig1_Richness.R
permissive
Hajibabaei-Lab/HajibabaeiEtAl2019b_benthos_vs_water
R
false
false
3,085
r
# Teresita M. Porter, Sept. 9, 2019 library(vegan) library(reshape2) library(gridExtra) library(grid) library(ggplot2) library(plyr) library(data.table) library("car") library(stringr) library("ggpubr") # Read infile A<-read.table(file="matrix.csv", head=TRUE, sep=",") # Select phylum Arthropoda only B<-A[A$Phylum==...
plot.scaleCoef <- function(x, add=FALSE, # logical, if true add plot to current plot offsetby=0, # amount on x-axis by which to offset the plotted # estimates and confidence intervals, useful when add is TRUE ...
/R/plot.scaleCoef.R
no_license
cran/scaleCoef
R
false
false
10,626
r
plot.scaleCoef <- function(x, add=FALSE, # logical, if true add plot to current plot offsetby=0, # amount on x-axis by which to offset the plotted # estimates and confidence intervals, useful when add is TRUE ...
library(igraph) configModel <- function (degrees = rep(n, floor(n / 2)), membership = rep(1, n), P = NULL) { # Checking P if (!is.null(P)) { if (!is.matrix(P)) stop('P must be a matrix\n') K <- max(membership) if (nrow(P) != K) stop('P must have K rows\n') } ...
/configModel.R
no_license
jpalowitch/configModel
R
false
false
1,457
r
library(igraph) configModel <- function (degrees = rep(n, floor(n / 2)), membership = rep(1, n), P = NULL) { # Checking P if (!is.null(P)) { if (!is.matrix(P)) stop('P must be a matrix\n') K <- max(membership) if (nrow(P) != K) stop('P must have K rows\n') } ...
#' Summarize the Multiple Imputation of Multivariate Regression Discontinuity Estimation #' #' \code{summary.mrdi} is a \code{summary} method for class \code{"mrdi"} #' #' @method summary mrdi #' #' @param object An object of class \code{"mrdi"}, usually a result of a call to #' \code{\link{mrd_impute}} with \code{...
/R/summary.mrdi.R
no_license
kimberlywebb/rddapp
R
false
false
12,587
r
#' Summarize the Multiple Imputation of Multivariate Regression Discontinuity Estimation #' #' \code{summary.mrdi} is a \code{summary} method for class \code{"mrdi"} #' #' @method summary mrdi #' #' @param object An object of class \code{"mrdi"}, usually a result of a call to #' \code{\link{mrd_impute}} with \code{...
build.dist.struct <- function(z, X, exact = NULL, calip.option = 'propensity', calip.cov = NULL, caliper = 0.2, verbose = FALSE){ cal.penalty <- 100 if(is.null(exact)) exact = rep(1, length(z)) if(!(calip.option %in% c('propensity','user','none'))){ stop('Invalid calip.option specified.') } if (is.vector(X...
/R/build.dist.struct.R
no_license
cran/rcbalance
R
false
false
3,983
r
build.dist.struct <- function(z, X, exact = NULL, calip.option = 'propensity', calip.cov = NULL, caliper = 0.2, verbose = FALSE){ cal.penalty <- 100 if(is.null(exact)) exact = rep(1, length(z)) if(!(calip.option %in% c('propensity','user','none'))){ stop('Invalid calip.option specified.') } if (is.vector(X...
###### categorical variable and factors marital.status <- c("Married","Married","Single","Married","Divorced","Widowed","Divorced") ?str() #### display the structure of the object str(marital.status) typeof(marital.status) ##### factor and levels marital.factor <- factor(marital.status) marital.factor str(marit...
/CodeBase/5_Categorical_Variable_And_factors.R
no_license
akashishu777/R-Practice
R
false
false
964
r
###### categorical variable and factors marital.status <- c("Married","Married","Single","Married","Divorced","Widowed","Divorced") ?str() #### display the structure of the object str(marital.status) typeof(marital.status) ##### factor and levels marital.factor <- factor(marital.status) marital.factor str(marit...
prompt_runtime_factory <- function() { last <- proc.time() last[] <- NA_real_ function(...) { diff <- proc.time() - last elapsed <- sum(diff) - diff["elapsed"] last <<- proc.time() if (!is.na(elapsed) && elapsed > 1) { paste0(round(elapsed), "s > ") } else { "> " } } } #'...
/R/prompts.R
no_license
jimhester/prompt
R
false
false
1,638
r
prompt_runtime_factory <- function() { last <- proc.time() last[] <- NA_real_ function(...) { diff <- proc.time() - last elapsed <- sum(diff) - diff["elapsed"] last <<- proc.time() if (!is.na(elapsed) && elapsed > 1) { paste0(round(elapsed), "s > ") } else { "> " } } } #'...
#' Plot Google Earth images obtained through dismo::gmap #' #' This function is very slightly modified from \code{.plotCT} function in \code{raster} package to avoid producing an empty plot before the actual Google image. #' #' @param x RasterLayer, as obtained through \code{\link[dismo]{gmap}}. #' @param maxpixels in...
/R/plot_gmap.R
no_license
raianu191/rSDM
R
false
false
3,634
r
#' Plot Google Earth images obtained through dismo::gmap #' #' This function is very slightly modified from \code{.plotCT} function in \code{raster} package to avoid producing an empty plot before the actual Google image. #' #' @param x RasterLayer, as obtained through \code{\link[dismo]{gmap}}. #' @param maxpixels in...
############################################################################################################################################################################################## #Random Forest for Northern California to investigate the LU variables directly related to the MMI scores.... #16March2015 ######...
/misc R scripts/NC_RandomForest/NC_RF_MMItoLU.R
no_license
usubuglab/AIM_2016
R
false
false
13,730
r
############################################################################################################################################################################################## #Random Forest for Northern California to investigate the LU variables directly related to the MMI scores.... #16March2015 ######...
# V-fold Cross-validation wrapper for SuperLearner CV.SuperLearner <- function(Y, X, V = NULL, family = gaussian(), SL.library, method = 'method.NNLS', id = NULL, verbose = FALSE, control = list(saveFitLibrary = FALSE), cvControl = list(), innerCvControl = list(), obsWeights = NULL, saveAll = TRUE, parallel = "seq", e...
/R/CV.SuperLearner.R
no_license
frbl/SuperLearner
R
false
false
5,986
r
# V-fold Cross-validation wrapper for SuperLearner CV.SuperLearner <- function(Y, X, V = NULL, family = gaussian(), SL.library, method = 'method.NNLS', id = NULL, verbose = FALSE, control = list(saveFitLibrary = FALSE), cvControl = list(), innerCvControl = list(), obsWeights = NULL, saveAll = TRUE, parallel = "seq", e...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/defaults.R \name{default_fvars} \alias{default_fvars} \title{default fvars} \usage{ default_fvars(object) } \arguments{ \item{object}{SummarizedExperiment} } \value{ string vector } \description{ default fvars } \examples{ if (require(autonom...
/autonomics.plot/man/default_fvars.Rd
no_license
bhagwataditya/autonomics0
R
false
true
442
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/defaults.R \name{default_fvars} \alias{default_fvars} \title{default fvars} \usage{ default_fvars(object) } \arguments{ \item{object}{SummarizedExperiment} } \value{ string vector } \description{ default fvars } \examples{ if (require(autonom...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/generics-getters.R \name{getDefaultPackageData} \alias{getDefaultPackageData} \title{Get a list shared across modules within a same package} \usage{ getDefaultPackageData() } \value{ A \code{\link[dipsaus]{fastmap2}} instance } \description{ ...
/man/getDefaultPackageData.Rd
no_license
dipterix/ravecore
R
false
true
535
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/generics-getters.R \name{getDefaultPackageData} \alias{getDefaultPackageData} \title{Get a list shared across modules within a same package} \usage{ getDefaultPackageData() } \value{ A \code{\link[dipsaus]{fastmap2}} instance } \description{ ...
library(RSurveillance) ### Name: n.tp ### Title: Sample size for true prevalence ### Aliases: n.tp ### Keywords: methods ### ** Examples # examples for n.tp n.tp(0.1, 0.9, 0.99, 0.05) n.tp(0.1, 0.9, 0.99, 0.05, conf = 0.99) n.tp(c(0.05, 0.1, 0.2, 0.3, 0.4, 0.5), 0.9, 0.99, 0.05) n.tp(0.5, 0.9, 0.99, c(0.01, 0.02, 0...
/data/genthat_extracted_code/RSurveillance/examples/n.tp.Rd.R
no_license
surayaaramli/typeRrh
R
false
false
339
r
library(RSurveillance) ### Name: n.tp ### Title: Sample size for true prevalence ### Aliases: n.tp ### Keywords: methods ### ** Examples # examples for n.tp n.tp(0.1, 0.9, 0.99, 0.05) n.tp(0.1, 0.9, 0.99, 0.05, conf = 0.99) n.tp(c(0.05, 0.1, 0.2, 0.3, 0.4, 0.5), 0.9, 0.99, 0.05) n.tp(0.5, 0.9, 0.99, c(0.01, 0.02, 0...
library(mvtnorm) library(fBasics) set.seed(1) N=1000 m=N/100 tt=seq(0,1, length.out = N) # USE M AS SAME NOTATION IN OUR LATEX FILE - M AND NOT H t=vector(mode = "list", length = m) # TAKE SUBSET OF THE GRAM MATRIX for (i in 1:m) { t[[i]]=tt[1:(m*10*i)] } kernel_family=0 #KSE Omega_t...
/R_code_Experiments/Ex_1_alg2_wrong.R
no_license
andreas-koukorinis/EMD_GP_Gareth_Marta_Dorota
R
false
false
4,241
r
library(mvtnorm) library(fBasics) set.seed(1) N=1000 m=N/100 tt=seq(0,1, length.out = N) # USE M AS SAME NOTATION IN OUR LATEX FILE - M AND NOT H t=vector(mode = "list", length = m) # TAKE SUBSET OF THE GRAM MATRIX for (i in 1:m) { t[[i]]=tt[1:(m*10*i)] } kernel_family=0 #KSE Omega_t...
library(smcsmcTools) library(rjson) library(GGally) library(dplyr) library(stringi) library(scales) library(ggalt) config = fromJSON(file = "~/repos/eurasian-backmigration/analyses/sgdp_replication.json") source = names_from_config(config$source) # from tools source_strings = vapply(source, ids_to_names, character(1)...
/r/sgdp_subset_individual_mig.R
no_license
Chris1221/ancient_african_admixture
R
false
false
3,526
r
library(smcsmcTools) library(rjson) library(GGally) library(dplyr) library(stringi) library(scales) library(ggalt) config = fromJSON(file = "~/repos/eurasian-backmigration/analyses/sgdp_replication.json") source = names_from_config(config$source) # from tools source_strings = vapply(source, ids_to_names, character(1)...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/utils.R \name{.silenceF} \alias{.silenceF} \title{Silencing Functions} \usage{ .silenceF(f, level = 7L) } \arguments{ \item{f}{function to silence} \item{level}{a single numeric (integer) that indicates the silencing level, which encodes the...
/man/dot-silenceF.Rd
no_license
Bhanditz/pkgmaker
R
false
true
1,818
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/utils.R \name{.silenceF} \alias{.silenceF} \title{Silencing Functions} \usage{ .silenceF(f, level = 7L) } \arguments{ \item{f}{function to silence} \item{level}{a single numeric (integer) that indicates the silencing level, which encodes the...
packages_to_install <- c( "devtools", "dplyr", "ggplot2", "knitr", "magrittr", "rmarkdown", "tidyr" ) install.packages( packages_to_install, dep = TRUE, repos = "http://cran.rstudio.com" )
/r-packages.R
permissive
briandk/docker-academic-writing
R
false
false
210
r
packages_to_install <- c( "devtools", "dplyr", "ggplot2", "knitr", "magrittr", "rmarkdown", "tidyr" ) install.packages( packages_to_install, dep = TRUE, repos = "http://cran.rstudio.com" )
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/package.R \docType{package} \name{princurve-package} \alias{princurve-package} \alias{princurve} \title{Fit a Principal Curve in Arbitrary Dimension} \description{ Fit a principal curve which describes a smooth curve that passes through the \...
/man/princurve-package.Rd
no_license
rcannood/princurve
R
false
true
1,088
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/package.R \docType{package} \name{princurve-package} \alias{princurve-package} \alias{princurve} \title{Fit a Principal Curve in Arbitrary Dimension} \description{ Fit a principal curve which describes a smooth curve that passes through the \...
options(scipen = 999) args <- commandArgs(trailingOnly = TRUE) adds <- args[1] removes <- args[2] lookups <- args[3] repetitions <- args[4] a <- sample(1 : adds, adds) b <- sample(a, removes) if (repetitions == 0) { c <- sample(a, lookups) } else { c <- sample(a, lookups, replace = TRUE) } write(c(0, adds, remo...
/Inputs/input_generator.R
no_license
AndreCascais/SelfBalancingTrees
R
false
false
427
r
options(scipen = 999) args <- commandArgs(trailingOnly = TRUE) adds <- args[1] removes <- args[2] lookups <- args[3] repetitions <- args[4] a <- sample(1 : adds, adds) b <- sample(a, removes) if (repetitions == 0) { c <- sample(a, lookups) } else { c <- sample(a, lookups, replace = TRUE) } write(c(0, adds, remo...
#!/usr/bin/env Rscript ####### # LOG # ####### log <- file(snakemake@log[[1]], open = "wt") sink(log, type = "message") sink(log, append = TRUE, type = "output") ############# # LIBRARIES # ############# library(data.table) ########### # GLOBALS # ########### interpro_res <- snakemake@input[["interpro_res"]] blas...
/src/full_viral_table.R
no_license
sarahinwood/microctonus-viral
R
false
false
498
r
#!/usr/bin/env Rscript ####### # LOG # ####### log <- file(snakemake@log[[1]], open = "wt") sink(log, type = "message") sink(log, append = TRUE, type = "output") ############# # LIBRARIES # ############# library(data.table) ########### # GLOBALS # ########### interpro_res <- snakemake@input[["interpro_res"]] blas...
## The function takes two arguments:an outcome name (outcome) and the ranking of ## a hospital (num), and returns a 2-column data frame with the name of the hospital ## in each state that has the ranking specified in num rankall <- function(outcome,num="best"){ data<-read.csv("outcome-of-care-measures.csv",string...
/C2Week4/rankall3.R
no_license
Shawvin/Data-Specilisation
R
false
false
673
r
## The function takes two arguments:an outcome name (outcome) and the ranking of ## a hospital (num), and returns a 2-column data frame with the name of the hospital ## in each state that has the ranking specified in num rankall <- function(outcome,num="best"){ data<-read.csv("outcome-of-care-measures.csv",string...
# Load required packages library(readxl) library(tidyverse) ################ IMPORTING DATA ################ # Reading in CSV files read_csv("data/mydata.csv") # Read in and save data mydata <- read_csv("data/mydata.csv") # reading in an Excel file excel_sheets("data/mydata.xlsx") read_excel("data/mydata.xlsx", s...
/Internet/2018 - Intro to R Bootcamp/Module 02/script2.R
permissive
tarsoqueiroz/Rlang
R
false
false
1,837
r
# Load required packages library(readxl) library(tidyverse) ################ IMPORTING DATA ################ # Reading in CSV files read_csv("data/mydata.csv") # Read in and save data mydata <- read_csv("data/mydata.csv") # reading in an Excel file excel_sheets("data/mydata.xlsx") read_excel("data/mydata.xlsx", s...
# # samplesize_twofactorindindpower <- function(k1=3,k2=3,effectsize=0.8,sig_level = 0.05,power=0.8,forplot=FALSE,samplerange=NULL,effectsizerange=NULL){ k=k1*k2 library(pwr);library(jsonlite) if(!forplot){ result = ceiling(pwr.anova.test(k = k, f = effectsize, sig.level = sig_level, power = power)$n) }else...
/MetDADevelopmentR/rscript/samplesize_twofactorindindpower.R
no_license
slfan2013/MetDA-development
R
false
false
1,137
r
# # samplesize_twofactorindindpower <- function(k1=3,k2=3,effectsize=0.8,sig_level = 0.05,power=0.8,forplot=FALSE,samplerange=NULL,effectsizerange=NULL){ k=k1*k2 library(pwr);library(jsonlite) if(!forplot){ result = ceiling(pwr.anova.test(k = k, f = effectsize, sig.level = sig_level, power = power)$n) }else...
#' @title Generates a new set of knots for the following iteration #' @description A sub-function of \code{\link{StagedChoiceSplineMix}}. This function generates a new set of knots for the following iteration. Please refer to Bruch et al. (in press) for the precise rule used. #' @param num.knot See \code{\link{Staged...
/R/move.knot.r
no_license
cran/StagedChoiceSplineMix
R
false
false
2,157
r
#' @title Generates a new set of knots for the following iteration #' @description A sub-function of \code{\link{StagedChoiceSplineMix}}. This function generates a new set of knots for the following iteration. Please refer to Bruch et al. (in press) for the precise rule used. #' @param num.knot See \code{\link{Staged...
##split test/train dataset for cross-validation, generating the input tables and lists of predictors for the models set.seed(1234) ##function to generate the list of variables to include in an analysis ##vars = initial list of variables to include (some may be removed if there are few unique values) ##tab = table of d...
/machine_learning/1_format_model_inputs.R
permissive
CDCgov/Predicting_TB_cluster_growth
R
false
false
5,011
r
##split test/train dataset for cross-validation, generating the input tables and lists of predictors for the models set.seed(1234) ##function to generate the list of variables to include in an analysis ##vars = initial list of variables to include (some may be removed if there are few unique values) ##tab = table of d...
############################################################################# # # XLConnect # Copyright (C) 2010-2021 Mirai Solutions GmbH # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation...
/R/workbook.appendWorksheet.R
no_license
harisxue/xlconnect
R
false
false
2,194
r
############################################################################# # # XLConnect # Copyright (C) 2010-2021 Mirai Solutions GmbH # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation...
#' trigrame feature vector #' @description This feature vector is 8000-dimentional feature vector wich is computed from tri-gram probability matrix #'T obtained from PSSM Matrix.to achieve this purpose elements in three successive rows and arbitrary columns are multiplied #'together then these results are added toget...
/R/AAtrigrame_pssm.R
no_license
minghao2016/PSSMCOOL-1
R
false
false
1,713
r
#' trigrame feature vector #' @description This feature vector is 8000-dimentional feature vector wich is computed from tri-gram probability matrix #'T obtained from PSSM Matrix.to achieve this purpose elements in three successive rows and arbitrary columns are multiplied #'together then these results are added toget...
data <- read.table("foo.txt") ## Reading in Larger Datasets with read.table initial <- read.table("datatable.txt", nrows = 100) classes <- sapply(initial, class) tabAll <- read.table("datatable.txt", colClasses = classes) ## dput-ting R Objects y <- data.frame(a = 1, b = "a") dput(y) structure(list(a = 1, ...
/2. R Programming/ReadingData.R
no_license
shubhamjanhere/Coursera-Data-Science-Specialization
R
false
false
1,117
r
data <- read.table("foo.txt") ## Reading in Larger Datasets with read.table initial <- read.table("datatable.txt", nrows = 100) classes <- sapply(initial, class) tabAll <- read.table("datatable.txt", colClasses = classes) ## dput-ting R Objects y <- data.frame(a = 1, b = "a") dput(y) structure(list(a = 1, ...
#' Select TextGrid Tier by its name #' #' This function takes a TextGrid and a name (character string), and returns the specified tier from that TextGrid #' @param tg TextGrid data, returned from readTextGrid() function #' @param tier_name character string. The name of the tier to retrive from TextGrid \code{tg} #' @ex...
/R/getTierByName.R
no_license
fauxneticien/phonpack
R
false
false
801
r
#' Select TextGrid Tier by its name #' #' This function takes a TextGrid and a name (character string), and returns the specified tier from that TextGrid #' @param tg TextGrid data, returned from readTextGrid() function #' @param tier_name character string. The name of the tier to retrive from TextGrid \code{tg} #' @ex...
######################################################################################################################## ## RnBSet-class.R ## created: 2012-04-06 ## creator: Pavlo Lutsik ## --------------------------------------------------------------------------------------------------------------------- ## RnBSet cl...
/R/RnBSet-class.R
no_license
epigen/RnBeads
R
false
false
94,066
r
######################################################################################################################## ## RnBSet-class.R ## created: 2012-04-06 ## creator: Pavlo Lutsik ## --------------------------------------------------------------------------------------------------------------------- ## RnBSet cl...
args <- commandArgs(TRUE) path_to_sig_file <- as.character(args[1]) path_to_file_bsmooth <- as.character(args[2]) path_to_file_dss <- as.character(args[3]) path_to_file_methylkit <- as.character(args[4]) path_to_file_metilene <- as.character(args[5]) path_to_file_rnbeads <- as.character(args[6]) sig <- read.t...
/01_scripts/additional_scripts/Evaluation/MethDiff.R
no_license
HeleneLuessem/Meta-Analysis-of-DMR-Finders
R
false
false
4,857
r
args <- commandArgs(TRUE) path_to_sig_file <- as.character(args[1]) path_to_file_bsmooth <- as.character(args[2]) path_to_file_dss <- as.character(args[3]) path_to_file_methylkit <- as.character(args[4]) path_to_file_metilene <- as.character(args[5]) path_to_file_rnbeads <- as.character(args[6]) sig <- read.t...
########################################################## # A modification of ITCsegment package by Michele Dalponte # Changes made by Tom Swinfield for the RSPB under funding from the Cambridge Conservation Initiative # Collaborative Fund ########################################################## # Changes made: #...
/ITC segment update.R
no_license
swinersha/Tree-crown-segmentation
R
false
false
15,833
r
########################################################## # A modification of ITCsegment package by Michele Dalponte # Changes made by Tom Swinfield for the RSPB under funding from the Cambridge Conservation Initiative # Collaborative Fund ########################################################## # Changes made: #...
PM25data <- readRDS("summarySCC_PM25.rds") PM25data_BC_vehicle <- subset(PM25data, fips == "24510" & type == "ON-ROAD") ##use type ON-ROAD to define motor vehicle source PM25data_BC_vehicle_totalbyyear <- tapply(PM25data_BC_vehicle$Emissions, PM25data_BC_vehicle$year, sum, na.rm=TRUE) plot(names(PM25data_BC_veh...
/plot5.R
no_license
wenlytang/ExData_Plotting2
R
false
false
595
r
PM25data <- readRDS("summarySCC_PM25.rds") PM25data_BC_vehicle <- subset(PM25data, fips == "24510" & type == "ON-ROAD") ##use type ON-ROAD to define motor vehicle source PM25data_BC_vehicle_totalbyyear <- tapply(PM25data_BC_vehicle$Emissions, PM25data_BC_vehicle$year, sum, na.rm=TRUE) plot(names(PM25data_BC_veh...
germline_patient_surv <- germline_patient_data %>% distinct(avatar_id, .keep_all = TRUE) ################################################################################### I ### PFS/OS hct date by HCT---- # From Dx mysurv <- Surv(time = germline_patient_surv$month_at_progression_Dx, event = germline_patient_surv$Progr...
/R/7.2.Treatment survivals.R
no_license
GillisLabAtMoffitt/CHIP-Avatar
R
false
false
70,488
r
germline_patient_surv <- germline_patient_data %>% distinct(avatar_id, .keep_all = TRUE) ################################################################################### I ### PFS/OS hct date by HCT---- # From Dx mysurv <- Surv(time = germline_patient_surv$month_at_progression_Dx, event = germline_patient_surv$Progr...
context("nnm") test_that("nnm.fit classification", { x = iris[, 1:4] y = iris[, 5] mod = nnm.fit(x, y, list(Dense(4, 6), Dense(6, 3, Activation.Identity), Softmax)) expect_equal(length(mod$fitted), length(y)) }) test_that("nnm.fit regression", { x = iris[, 1:3] y = iris[, 4] mod = nnm.fit(...
/tests/testthat/test_nnm.R
permissive
chuanwen/nnm
R
false
false
1,901
r
context("nnm") test_that("nnm.fit classification", { x = iris[, 1:4] y = iris[, 5] mod = nnm.fit(x, y, list(Dense(4, 6), Dense(6, 3, Activation.Identity), Softmax)) expect_equal(length(mod$fitted), length(y)) }) test_that("nnm.fit regression", { x = iris[, 1:3] y = iris[, 4] mod = nnm.fit(...
library(testthat) library(recipes) context("Matrix data types") ################################################################### data(okc) okc$diet <- as.factor(okc$diet) okc$date <- as.Date(okc$date) okc$location <- as.factor(okc$location) okc_tr <- okc[1:400, ] okc_te <- okc[(401:800), ] ###################...
/tests/testthat/test_matrix.R
no_license
EmilHvitfeldt/recipes
R
false
false
1,827
r
library(testthat) library(recipes) context("Matrix data types") ################################################################### data(okc) okc$diet <- as.factor(okc$diet) okc$date <- as.Date(okc$date) okc$location <- as.factor(okc$location) okc_tr <- okc[1:400, ] okc_te <- okc[(401:800), ] ###################...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/route53resolver_operations.R \name{route53resolver_get_resolver_rule_policy} \alias{route53resolver_get_resolver_rule_policy} \title{Gets information about a resolver rule policy} \usage{ route53resolver_get_resolver_rule_policy(Arn) } \argum...
/paws/man/route53resolver_get_resolver_rule_policy.Rd
permissive
johnnytommy/paws
R
false
true
735
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/route53resolver_operations.R \name{route53resolver_get_resolver_rule_policy} \alias{route53resolver_get_resolver_rule_policy} \title{Gets information about a resolver rule policy} \usage{ route53resolver_get_resolver_rule_policy(Arn) } \argum...
#' @import stats #' @import ggplot2 precision = getFromNamespace("precision", "scales") #' @importFrom magrittr %>% #' @export magrittr::`%>%` #' @importFrom magrittr %<>% #' @export magrittr::`%<>%` #' Parent Function: Power of a number. #' #' This is an internal function to generate another ones which will be #' ...
/R/helpers.R
permissive
lfpdroubi/appraiseR
R
false
false
9,515
r
#' @import stats #' @import ggplot2 precision = getFromNamespace("precision", "scales") #' @importFrom magrittr %>% #' @export magrittr::`%>%` #' @importFrom magrittr %<>% #' @export magrittr::`%<>%` #' Parent Function: Power of a number. #' #' This is an internal function to generate another ones which will be #' ...
/models/KNN_model.R
no_license
Wynnlin329/R_EDA_minning
R
false
false
725
r
#************** INTRODUCTION TO STATISTICS ********************************** #Types of data: Quantitative, Qualitative, Logical, Missing, Other types #Quantitative: Discrete -- takes values in a finite and countable way. # Continuous -- Takes values in an interval of numbers (decimal values). #R comes...
/ch4_sumarize_data.R
no_license
hsimspace/statistics_with_r
R
false
false
702
r
#************** INTRODUCTION TO STATISTICS ********************************** #Types of data: Quantitative, Qualitative, Logical, Missing, Other types #Quantitative: Discrete -- takes values in a finite and countable way. # Continuous -- Takes values in an interval of numbers (decimal values). #R comes...
<html> <head> <meta name="TextLength" content="SENT_NUM:4, WORD_NUM:92"> </head> <body bgcolor="white"> <a href="#0" id="0">Tass said 748 of the injured had to be hospitalized and said a search was continuing for a police officer who vanished June 7.</a> <a href="#1" id="1">It was the latest in a series of bloody civil...
/DUC-Dataset/Summary_p100_R/D105.AP900613-0195.html.R
no_license
Angela7126/SLNSumEval
R
false
false
763
r
<html> <head> <meta name="TextLength" content="SENT_NUM:4, WORD_NUM:92"> </head> <body bgcolor="white"> <a href="#0" id="0">Tass said 748 of the injured had to be hospitalized and said a search was continuing for a police officer who vanished June 7.</a> <a href="#1" id="1">It was the latest in a series of bloody civil...
test_that("grade_code() - allow_partial_matching works 2 errors", { expect_grade_code( user_code = "purrr::insistently(mean,quie = TRUE,rat = rate_backoff())", solution_code = "purrr::insistently(mean,quiet = TRUE,rate = rate_backoff())", is_correct = TRUE ) expect_grade_code( user_code = "purrr::...
/tests/testthat/test-allow_partial_matching.R
permissive
rstudio/gradethis
R
false
false
11,263
r
test_that("grade_code() - allow_partial_matching works 2 errors", { expect_grade_code( user_code = "purrr::insistently(mean,quie = TRUE,rat = rate_backoff())", solution_code = "purrr::insistently(mean,quiet = TRUE,rate = rate_backoff())", is_correct = TRUE ) expect_grade_code( user_code = "purrr::...
context("get_followers") test_that("get_followers returns data frame with user_id", { skip_on_cran() skip_if_offline() token <- readRDS("twitter_tokens") rl <- rate_limit(token, "get_followers") if (rl$remaining > 1) { f <- get_followers("HillaryClinton", n = 10000, token = token) expect_true(i...
/tests/testthat/test_get_followers.R
no_license
zzqqzzqqzz/rtweet
R
false
false
601
r
context("get_followers") test_that("get_followers returns data frame with user_id", { skip_on_cran() skip_if_offline() token <- readRDS("twitter_tokens") rl <- rate_limit(token, "get_followers") if (rl$remaining > 1) { f <- get_followers("HillaryClinton", n = 10000, token = token) expect_true(i...
rm(list = ls()) library(tidyverse) library(foreach) library(matrixStats) library(here) folder_path <- here("data/PO4Ca_GT/umbrella/10blocks/") file_name <- "PO4Ca_GT" n_block <- 10 all_pmfs <- foreach( i = 0:(n_block-1), .combine = "c") %do% { pmf_file <- paste(folder_path, "pmf", i, ".xvg", sep = "") all_c...
/utilities/get_PMF/block_average_PO4Ca_GT.R
no_license
andy90/DNA_simulation
R
false
false
1,745
r
rm(list = ls()) library(tidyverse) library(foreach) library(matrixStats) library(here) folder_path <- here("data/PO4Ca_GT/umbrella/10blocks/") file_name <- "PO4Ca_GT" n_block <- 10 all_pmfs <- foreach( i = 0:(n_block-1), .combine = "c") %do% { pmf_file <- paste(folder_path, "pmf", i, ".xvg", sep = "") all_c...
#' @title Create table 1, part 1 from the credit union publication #' #' @description Creates Table 1, part 1 from the \href{https://www.bankofengland.co.uk/news?NewsTypes=571948d14c6943f7b5b7748ad80bef29&Direction=Upcoming}{Credit Union Quarterly Release}. #' #' @details \code{table_1} takes as input a standardise...
/table_1_part_1.R
no_license
JoshuaAllenBoE/CreditUnionRAP
R
false
false
1,881
r
#' @title Create table 1, part 1 from the credit union publication #' #' @description Creates Table 1, part 1 from the \href{https://www.bankofengland.co.uk/news?NewsTypes=571948d14c6943f7b5b7748ad80bef29&Direction=Upcoming}{Credit Union Quarterly Release}. #' #' @details \code{table_1} takes as input a standardise...
### NOTE TO USERS ### #' The following code uses parellel computation with up to 30 cores being used at once. #' Parallelization was completed using the mclapply function. To run this script locally, #' replace mclapply with lapply and remove the mc.cores parameter. This quantile #' estimator should be able to run lo...
/analyses_scripts/unimodal_quantile_estimates.R
no_license
mbelitz/belitz_etal_phenometrics
R
false
false
39,146
r
### NOTE TO USERS ### #' The following code uses parellel computation with up to 30 cores being used at once. #' Parallelization was completed using the mclapply function. To run this script locally, #' replace mclapply with lapply and remove the mc.cores parameter. This quantile #' estimator should be able to run lo...
# Check if both data exist. If not, load the data. if (!"data" %in% ls()) { pmData <- readRDS("./data/summarySCC_PM25.rds") } if (!"data" %in% ls()) { classData <- readRDS("./data/Source_Classification_Code.rds") } #plt the data par("mar"=c(5.1, 4.5, 4.1, 2.1)) png(filename = "plot4.png", width = ...
/plot4.R
no_license
ez3804/ExData_Prj2
R
false
false
762
r
# Check if both data exist. If not, load the data. if (!"data" %in% ls()) { pmData <- readRDS("./data/summarySCC_PM25.rds") } if (!"data" %in% ls()) { classData <- readRDS("./data/Source_Classification_Code.rds") } #plt the data par("mar"=c(5.1, 4.5, 4.1, 2.1)) png(filename = "plot4.png", width = ...
# Run this on Domino #### source('/mnt/simulator/sim_phenos.R') source('/mnt/simulator/create_cross_design.R') source('/mnt/simulator/make_crosses.R') source('/mnt/simulator/calc_TGV.R') source('/mnt/simulator/extract_selections.R') source('/mnt/simulator/create_map.R') source('/mnt/simulator/create_parents.R') source(...
/replicate_GF_study/volume.R
permissive
arfesta/SimBreeder_Project
R
false
false
5,495
r
# Run this on Domino #### source('/mnt/simulator/sim_phenos.R') source('/mnt/simulator/create_cross_design.R') source('/mnt/simulator/make_crosses.R') source('/mnt/simulator/calc_TGV.R') source('/mnt/simulator/extract_selections.R') source('/mnt/simulator/create_map.R') source('/mnt/simulator/create_parents.R') source(...
best <- function(state, outcome) { ##Read outcome data data <- read.csv("outcome-of-care-measures.csv", colClasses = "character") fulldata <- as.data.frame(cbind(data[, 2], ##hospital data[, 7], ##state data[, 11], ##heart attack ...
/best.R
no_license
abheekbiswas/ProgrammingAssignment3
R
false
false
1,258
r
best <- function(state, outcome) { ##Read outcome data data <- read.csv("outcome-of-care-measures.csv", colClasses = "character") fulldata <- as.data.frame(cbind(data[, 2], ##hospital data[, 7], ##state data[, 11], ##heart attack ...
library(ggplot2) library(dplyr) library(gridExtra) library(timetk) ### Plot time series for variables load('data/FL.Rda') fl = FL %>% filter(policydate < as.Date("2019-08-01")) %>% summarise_by_time(.date_var = policydate, .by= "year", cost = mean(policycost), num = ...
/not used/timeser_Onestates.R
no_license
LenaChretien/National_flood_insurance
R
false
false
6,463
r
library(ggplot2) library(dplyr) library(gridExtra) library(timetk) ### Plot time series for variables load('data/FL.Rda') fl = FL %>% filter(policydate < as.Date("2019-08-01")) %>% summarise_by_time(.date_var = policydate, .by= "year", cost = mean(policycost), num = ...
/semaforos.R
permissive
fagnersutel/pontoscriticos
R
false
false
2,276
r
#Week 2 Quiz q5 file_url <- "https://d396qusza40orc.cloudfront.net/getdata%2Fwksst8110.for" df <- read.fwf(file_url, skip = 4, widths = c(12, 7, 4, 9, 4, 9, 4, 9, 4)) print(sum(df$V4))
/Getting_and_Cleaning_Data/W2_Quiz_q5.R
no_license
Mjvolk3/datasciencecoursera
R
false
false
185
r
#Week 2 Quiz q5 file_url <- "https://d396qusza40orc.cloudfront.net/getdata%2Fwksst8110.for" df <- read.fwf(file_url, skip = 4, widths = c(12, 7, 4, 9, 4, 9, 4, 9, 4)) print(sum(df$V4))
RNGkind(sample.kind="Rounding") library(bhpm) set.seed(14258) ######################### All events, Severity 1, Model BB_dependent ##################### print("######################### All events, Severity 1, Model BB level 1 #####################") data(demo.cluster.data) set.seed(9019) raw = bhpm.pm(demo.cluster....
/test/bhpm.pm/single_chain/default_parameters/test/run.r
no_license
rcarragh/bhpm
R
false
false
844
r
RNGkind(sample.kind="Rounding") library(bhpm) set.seed(14258) ######################### All events, Severity 1, Model BB_dependent ##################### print("######################### All events, Severity 1, Model BB level 1 #####################") data(demo.cluster.data) set.seed(9019) raw = bhpm.pm(demo.cluster....
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/tar_watch_ui.R \name{tar_watch_ui} \alias{tar_watch_ui} \title{Shiny module UI for tar_watch()} \usage{ tar_watch_ui( id, label = "tar_watch_label", seconds = 10, seconds_min = 1, seconds_max = 60, seconds_step = 1, targets_only...
/man/tar_watch_ui.Rd
permissive
ropensci/targets
R
false
true
3,479
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/tar_watch_ui.R \name{tar_watch_ui} \alias{tar_watch_ui} \title{Shiny module UI for tar_watch()} \usage{ tar_watch_ui( id, label = "tar_watch_label", seconds = 10, seconds_min = 1, seconds_max = 60, seconds_step = 1, targets_only...
#Run the script with the associated metabolite file. #Rscript compare_metab.R MetabTable_ForComparison.csv Results_features.txt args<-commandArgs(TRUE) data<-read.table(args[1],sep=",",row.names=1,header=TRUE) metab_pos<-grep("X",names(data)) results_data<-as.data.frame(matrix(NA,length(metab_pos),12)) for(i in 1:...
/compare_metab.R
permissive
mccall-lab-OU/GI-tract-paper
R
false
false
1,127
r
#Run the script with the associated metabolite file. #Rscript compare_metab.R MetabTable_ForComparison.csv Results_features.txt args<-commandArgs(TRUE) data<-read.table(args[1],sep=",",row.names=1,header=TRUE) metab_pos<-grep("X",names(data)) results_data<-as.data.frame(matrix(NA,length(metab_pos),12)) for(i in 1:...
# 9 April 2020—Lab 13 "Occupancy #### library(unmarked) library(MuMIn) library(ggplot2) # Single season occupancy #### badger <- read.csv("badger_occupancy_scotland.csv", header = TRUE) head(badger) badger.o <- unmarkedFrameOccu(y = badger[,4:25], siteCovs = badger[,c(26,27,32,41,46)]) plot(badger.o) pd...
/9_April_Occupancy.R
no_license
masond-UF/iQAAP
R
false
false
4,924
r
# 9 April 2020—Lab 13 "Occupancy #### library(unmarked) library(MuMIn) library(ggplot2) # Single season occupancy #### badger <- read.csv("badger_occupancy_scotland.csv", header = TRUE) head(badger) badger.o <- unmarkedFrameOccu(y = badger[,4:25], siteCovs = badger[,c(26,27,32,41,46)]) plot(badger.o) pd...
# Exercise 1: Creating and Indexing Vectors # Create a vector `first.ten` that has the values 10 through 20 in it (using the : operator) first.ten <- 10:20 # Create a vector `next.ten` that has the values 21 through 30 in it (using the seq operator) next.ten <- seq(21:30) # Create a vector `all.numbers` by combining...
/exercise-1/exercise.R
permissive
kevinwork98/ch7-vectors
R
false
false
985
r
# Exercise 1: Creating and Indexing Vectors # Create a vector `first.ten` that has the values 10 through 20 in it (using the : operator) first.ten <- 10:20 # Create a vector `next.ten` that has the values 21 through 30 in it (using the seq operator) next.ten <- seq(21:30) # Create a vector `all.numbers` by combining...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/Met_MatH.R \name{WH.var.covar} \alias{WH.var.covar} \alias{WH.var.covar,MatH-method} \title{Method WH.var.covar} \usage{ WH.var.covar(object, ...) \S4method{WH.var.covar}{MatH}(object, w = numeric(0)) } \arguments{ \item{object}{...
/man/WH.var.covar-methods.Rd
no_license
cran/HistDAWass
R
false
true
1,183
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/Met_MatH.R \name{WH.var.covar} \alias{WH.var.covar} \alias{WH.var.covar,MatH-method} \title{Method WH.var.covar} \usage{ WH.var.covar(object, ...) \S4method{WH.var.covar}{MatH}(object, w = numeric(0)) } \arguments{ \item{object}{...
### get parameters args = commandArgs(trailingOnly=TRUE) index_set_inputfile = args[1] regin_index_inputfile = args[2] regin_signal_inputfile = args[3] index_set_all_heatmap = args[4] index_set_thresh_heatmap = args[5] index_all_heatmap = args[6] ### read index set signal matrix read_enriched_index_set_matrix = func...
/bin/index_calling.R
no_license
guanjue/index_caller
R
false
false
13,686
r
### get parameters args = commandArgs(trailingOnly=TRUE) index_set_inputfile = args[1] regin_index_inputfile = args[2] regin_signal_inputfile = args[3] index_set_all_heatmap = args[4] index_set_thresh_heatmap = args[5] index_all_heatmap = args[6] ### read index set signal matrix read_enriched_index_set_matrix = func...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/fn.lambda.R \name{fn.lambda} \alias{fn.lambda} \title{Calculate recruitment bias based on environmental filtering} \usage{ fn.lambda(trait.optimum, niche.breadth, Ef, Ef.specificity) } \arguments{ \item{trait.optimum}{Optimum value for a give...
/man/fn.lambda.Rd
no_license
sokole/MCSim
R
false
true
1,195
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/fn.lambda.R \name{fn.lambda} \alias{fn.lambda} \title{Calculate recruitment bias based on environmental filtering} \usage{ fn.lambda(trait.optimum, niche.breadth, Ef, Ef.specificity) } \arguments{ \item{trait.optimum}{Optimum value for a give...