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
make.normal.density <- function () { tmp <- basic.get.density.lines(density.at = 0.5, mu = 0.5, sigma = 0.1, distribution = "normal", scale.factor = 0.5, x.axis = "linear") plot(tmp$y, -tmp$x, type = "n") lines(tmp$y, -tmp$x, type = "l", lwd = 7) }
/R/make.normal.density.R
no_license
anhnguyendepocen/SMRD
R
false
false
280
r
make.normal.density <- function () { tmp <- basic.get.density.lines(density.at = 0.5, mu = 0.5, sigma = 0.1, distribution = "normal", scale.factor = 0.5, x.axis = "linear") plot(tmp$y, -tmp$x, type = "n") lines(tmp$y, -tmp$x, type = "l", lwd = 7) }
library(plyr) folderPath = "UCI HAR Dataset/" getFilePath <- function(filepath) { paste(folderPath, filepath, sep="") } xTrainData <- read.table(getFilePath("train/X_train.txt")) xTestData <- read.table(getFilePath("test/X_test.txt")) xData <- rbind(xTrainData, xTestData) yTrainData <- read.table(getFilePath("train...
/run_analysis.R
no_license
vishi999/getting-cleaning-data-project
R
false
false
1,445
r
library(plyr) folderPath = "UCI HAR Dataset/" getFilePath <- function(filepath) { paste(folderPath, filepath, sep="") } xTrainData <- read.table(getFilePath("train/X_train.txt")) xTestData <- read.table(getFilePath("test/X_test.txt")) xData <- rbind(xTrainData, xTestData) yTrainData <- read.table(getFilePath("train...
library("knitr") library("rgl") #knit("1,4-dithi-in-2,3-dic.Rmd") #markdownToHTML('1,4-dithi-in-2,3-dic.md', '1,4-dithi-in-2,3-dic.html', options=c("use_xhml")) #system("pandoc -s 1,4-dithi-in-2,3-dic.html -o 1,4-dithi-in-2,3-dic.pdf") knit2html('1,4-dithi-in-2,3-dic.Rmd')
/FDA_Pesticide_Glossary/1,4-dithi-in-2,3-dic.R
permissive
andrewdefries/andrewdefries.github.io
R
false
false
276
r
library("knitr") library("rgl") #knit("1,4-dithi-in-2,3-dic.Rmd") #markdownToHTML('1,4-dithi-in-2,3-dic.md', '1,4-dithi-in-2,3-dic.html', options=c("use_xhml")) #system("pandoc -s 1,4-dithi-in-2,3-dic.html -o 1,4-dithi-in-2,3-dic.pdf") knit2html('1,4-dithi-in-2,3-dic.Rmd')
## Reference class based signature discovery and prediction ##temporary sourcing: source("CVSetup.R") source("MLRun.R") source("helperFunctions.R") #require("plotrix") require("Hmisc") if(!require("yaml")){ stop("Package yaml is a requirement to run this pipeline. Please install yaml.") } require(parallel) require(...
/R/PredictiveModelPipeline.R
permissive
mjafin/PredictiveModelPipeline
R
false
false
9,463
r
## Reference class based signature discovery and prediction ##temporary sourcing: source("CVSetup.R") source("MLRun.R") source("helperFunctions.R") #require("plotrix") require("Hmisc") if(!require("yaml")){ stop("Package yaml is a requirement to run this pipeline. Please install yaml.") } require(parallel) require(...
/man/MVA.test.Rd
no_license
pierozannini/RVAideMemoire
R
false
false
5,413
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/methods-hbr.R \docType{methods} \name{map,hbr-method} \alias{map} \alias{map,hbr-method} \alias{map.hbr} \title{Map from reconstructed haplotype-blocks to windows} \usage{ \S4method{map}{hbr}(object) } \arguments{ \item{object}{object of clas...
/man/map-hbr-method.Rd
no_license
popgenvienna/haploReconstruct
R
false
true
1,492
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/methods-hbr.R \docType{methods} \name{map,hbr-method} \alias{map} \alias{map,hbr-method} \alias{map.hbr} \title{Map from reconstructed haplotype-blocks to windows} \usage{ \S4method{map}{hbr}(object) } \arguments{ \item{object}{object of clas...
## Below is a pair of functions that cache the inverse of a matrix ## The first function, `makeCacheMatrix` creates a special "matrix", which is ## really a list containing a function to ## 1. set the value of the matrix ## 2. get the value of the matrix ## 3. set the value of the inverse ## 4. get the value of ...
/cachematrix.R
no_license
kencotter/ProgrammingAssignment2
R
false
false
1,476
r
## Below is a pair of functions that cache the inverse of a matrix ## The first function, `makeCacheMatrix` creates a special "matrix", which is ## really a list containing a function to ## 1. set the value of the matrix ## 2. get the value of the matrix ## 3. set the value of the inverse ## 4. get the value of ...
\name{GTreeBase} \alias{GTreeBase} \title{Base class} \usage{ GTreeBase(...) } \arguments{ \item{...}{passed to constructor} } \description{ For \code{GTree}, there are extra reference methods: \code{set_multiple} to set whether multiple or single selection is being used. }
/man/GTreeBase.Rd
no_license
jverzani/gWidgets2RGtk2
R
false
false
286
rd
\name{GTreeBase} \alias{GTreeBase} \title{Base class} \usage{ GTreeBase(...) } \arguments{ \item{...}{passed to constructor} } \description{ For \code{GTree}, there are extra reference methods: \code{set_multiple} to set whether multiple or single selection is being used. }
#Bubbles plot install.packages(pkgs = c("ggplot2","plotly"), dependencies = T) library(ggplot2) library(plotly) data <- read.csv(file.choose(), header=T, sep=";") #select file plot_ly(data, x = data$x, y = data$y , type="scatter", mode="markers" , marker=list(color="darkcadetblue" , size=...
/R/Bubbles-plot/bubbles-plot.R
no_license
julianademorais/cancer-secretome
R
false
false
691
r
#Bubbles plot install.packages(pkgs = c("ggplot2","plotly"), dependencies = T) library(ggplot2) library(plotly) data <- read.csv(file.choose(), header=T, sep=";") #select file plot_ly(data, x = data$x, y = data$y , type="scatter", mode="markers" , marker=list(color="darkcadetblue" , size=...
#' Calculates parameters for forecast time determination along the runtime axis #' #' This is a subroutine of \code{\link{loadSeasonalForecast.S4}} #' #' @param grid a java \sQuote{GeoGrid} #' @param dataset character string of the dataset #' @param dictionary dictionary information #' @param runTimePars A list of el...
/R/getForecastTimeDomain.S4.R
no_license
Predictia/ecomsUDG.Raccess
R
false
false
6,725
r
#' Calculates parameters for forecast time determination along the runtime axis #' #' This is a subroutine of \code{\link{loadSeasonalForecast.S4}} #' #' @param grid a java \sQuote{GeoGrid} #' @param dataset character string of the dataset #' @param dictionary dictionary information #' @param runTimePars A list of el...
library(RJSONIO) username <- "max.woolf" access_token <- "INSERT TOKEN HERE" nrows <- 5000 likeCategories <- character() likeNames <- character() getSTDFriendURL <- function(name,token) { return (paste("https://graph.facebook.com/", name,"/friends?access_token=", token, sep = "")) } getSTDLikesURL <- function(nam...
/Graph of User.R
no_license
gaybro8777/aggregate-data-from-likes-of-friends
R
false
false
2,079
r
library(RJSONIO) username <- "max.woolf" access_token <- "INSERT TOKEN HERE" nrows <- 5000 likeCategories <- character() likeNames <- character() getSTDFriendURL <- function(name,token) { return (paste("https://graph.facebook.com/", name,"/friends?access_token=", token, sep = "")) } getSTDLikesURL <- function(nam...
# Coursera Data Science Specialization # Course 4 - Exploratory Data Analysis # Week 1 - Course Project 1 # Thomas Miebach ## Read data, unzip and extract assignment data from the dates 2007-02-01 and 2007-02-02 url <- "https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip" download...
/plot4.R
no_license
TMiebach/ExData_Plotting1
R
false
false
2,100
r
# Coursera Data Science Specialization # Course 4 - Exploratory Data Analysis # Week 1 - Course Project 1 # Thomas Miebach ## Read data, unzip and extract assignment data from the dates 2007-02-01 and 2007-02-02 url <- "https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip" download...
# FRK: An R Software package for spatial and spatio-temporal prediction # with large datasets. # Copyright (c) 2017 University of Wollongong # Author: Andrew Zammit-Mangion, azm (at) uow.edu.au # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public ...
/FRK/R/datadoc.R
no_license
akhikolla/TestedPackages-NoIssues
R
false
false
4,758
r
# FRK: An R Software package for spatial and spatio-temporal prediction # with large datasets. # Copyright (c) 2017 University of Wollongong # Author: Andrew Zammit-Mangion, azm (at) uow.edu.au # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public ...
source("models.R") source("utils.R") library("dummies") sales_train_validation <- read.csv("data/sales_train_validation.csv",stringsAsFactors = FALSE) df_sales <-data.frame(sales_train_validation) rm(sales_train_validation) calendar <-read.csv("data/calendar.csv",stringsAsFactors = FALSE) df_calendar <-data.frame(cal...
/topdown_narx.R
no_license
SalNedia/m5competition_tesi
R
false
false
3,815
r
source("models.R") source("utils.R") library("dummies") sales_train_validation <- read.csv("data/sales_train_validation.csv",stringsAsFactors = FALSE) df_sales <-data.frame(sales_train_validation) rm(sales_train_validation) calendar <-read.csv("data/calendar.csv",stringsAsFactors = FALSE) df_calendar <-data.frame(cal...
# functions that parse data into usable formats once it's been scraped #' Parse PBP Event #' #' \code{parse_event()} parses a single event from the PBP JSON object #' #' @param x a single entry. #' @return a data.frame #' @export ds.parse_event <- function(x) { player_ids <- x$players %>% sapply(function(p) as....
/R/3_parse.R
no_license
deepfriar/dryscrape
R
false
false
8,255
r
# functions that parse data into usable formats once it's been scraped #' Parse PBP Event #' #' \code{parse_event()} parses a single event from the PBP JSON object #' #' @param x a single entry. #' @return a data.frame #' @export ds.parse_event <- function(x) { player_ids <- x$players %>% sapply(function(p) as....
#------------------------------------------------------------------------------------------# # Function readgrads # # Developed by Marcos Longo - EPS/Harvard University # # This function extracts the variablem, w...
/R-utils/readgrads.r
no_license
npp2016/ED2-1
R
false
false
15,001
r
#------------------------------------------------------------------------------------------# # Function readgrads # # Developed by Marcos Longo - EPS/Harvard University # # This function extracts the variablem, w...
Sys.getlocale("LC_TIME") ##get the time locale Sys.setlocale("LC_TIME", "English_United States.1252") ##set the time locale #Here I use functionality of dplyr package library(dplyr) setwd("./") #assign a variable to the destination folder destFolder <- "./HouseholdPowerConsumption2" #check weather director...
/Plot2.R
no_license
RoshanSPB/ExData_Plotting1
R
false
false
2,058
r
Sys.getlocale("LC_TIME") ##get the time locale Sys.setlocale("LC_TIME", "English_United States.1252") ##set the time locale #Here I use functionality of dplyr package library(dplyr) setwd("./") #assign a variable to the destination folder destFolder <- "./HouseholdPowerConsumption2" #check weather director...
# Biostat 682 Project # Loading and fiddlign with the dataset. setwd("/Users/noahgale/Desktop/UMich Classes and Clubs/Biostat 682/Project") data1 = read.csv("character-deaths.csv", header = TRUE) # data2 = read.csv("character-predictions.csv", header=TRUE) data1 = subset(data1, select=c(Name, Allegiances, Book.of.Dea...
/Project Biostat 682/Project Code/GoT-Bayesian.R
no_license
noah-gale/Git_folder
R
false
false
1,500
r
# Biostat 682 Project # Loading and fiddlign with the dataset. setwd("/Users/noahgale/Desktop/UMich Classes and Clubs/Biostat 682/Project") data1 = read.csv("character-deaths.csv", header = TRUE) # data2 = read.csv("character-predictions.csv", header=TRUE) data1 = subset(data1, select=c(Name, Allegiances, Book.of.Dea...
\docType{methods} \name{plotGeneAnnotation} \alias{plotGeneAnnotation} \alias{plotGeneAnnotation,AnnotationByFeature-method} \alias{plotGeneAnnotation,list-method} \title{Plots the enrichment of each feature in the set in the gene annotation} \usage{ plotGeneAnnotation(l, cluster=FALSE, col=c('white','cornflower...
/man/plotGeneAnnotation-methods.Rd
no_license
ttriche/genomation
R
false
false
1,175
rd
\docType{methods} \name{plotGeneAnnotation} \alias{plotGeneAnnotation} \alias{plotGeneAnnotation,AnnotationByFeature-method} \alias{plotGeneAnnotation,list-method} \title{Plots the enrichment of each feature in the set in the gene annotation} \usage{ plotGeneAnnotation(l, cluster=FALSE, col=c('white','cornflower...
#### GMK 2018 ##### #### impacts of selective logging on butterflies, Biological Conservation #### #### on the effects of logging intensity on species richness, abundance, and composition ### ### example code, not tested. any queries to mgm49@cam.ac.uk ### ### FIG. 3 #### rm(list=ls()) dev.off() library(ggplot2) libra...
/3-fig.3/fig3.may18.R
no_license
gmkov/selective-logging-butterflies-2018
R
false
false
10,375
r
#### GMK 2018 ##### #### impacts of selective logging on butterflies, Biological Conservation #### #### on the effects of logging intensity on species richness, abundance, and composition ### ### example code, not tested. any queries to mgm49@cam.ac.uk ### ### FIG. 3 #### rm(list=ls()) dev.off() library(ggplot2) libra...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{hline} \alias{hline} \title{set horizontal borders} \usage{ hline(x, i = NULL, j = NULL, border = NULL, part = "body") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{bo...
/man/hline.Rd
no_license
jranke/flextable
R
false
true
1,327
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/borders.R \name{hline} \alias{hline} \title{set horizontal borders} \usage{ hline(x, i = NULL, j = NULL, border = NULL, part = "body") } \arguments{ \item{x}{a flextable object} \item{i}{rows selection} \item{j}{columns selection} \item{bo...
\name{color.stimuli} \alias{color.stimuli} \docType{data} \title{ MMST COLOR.STIMULI DATA } \description{ perceptions of color, 468, 469, 503 } \usage{data(color.stimuli)} \format{ A distance matrix of colors represented by the following wavelengths (\emph{micrometers}): 434, 445, 465, 472, 490, 504, 537, 5...
/pkgs/MMST/man/color.stimuli.Rd
no_license
vaguiar/EDAV_Project_2017
R
false
false
635
rd
\name{color.stimuli} \alias{color.stimuli} \docType{data} \title{ MMST COLOR.STIMULI DATA } \description{ perceptions of color, 468, 469, 503 } \usage{data(color.stimuli)} \format{ A distance matrix of colors represented by the following wavelengths (\emph{micrometers}): 434, 445, 465, 472, 490, 504, 537, 5...
##Exploratory Data Analysis ##Project 1 ##Plot 1 ## Due the data size we'll use a fast read function library(data.table) data = fread("D:/PML/household_power_consumption.txt", sep = ";" ,header = T, na.strings = "?") #Lets subset the data, because we know the dates we'll use sample <- data[data$Date...
/plot1.R
no_license
aacorrea/ExData_Plotting1
R
false
false
621
r
##Exploratory Data Analysis ##Project 1 ##Plot 1 ## Due the data size we'll use a fast read function library(data.table) data = fread("D:/PML/household_power_consumption.txt", sep = ";" ,header = T, na.strings = "?") #Lets subset the data, because we know the dates we'll use sample <- data[data$Date...
# Test if V-Party meets the many packages universe requirements # Import v-Party vdem <- import_vdem() # Report missing values on a random subset of vdem test_that("missing observations are reported correctly", { expect_false(any(grepl("^n/a$", vdem[sample(nrow(vdem), 1000), ]))) expect_false(any(grepl("^N/A$", v...
/tests/testthat/test_V-Dem.R
permissive
globalgov/manystates
R
false
false
1,817
r
# Test if V-Party meets the many packages universe requirements # Import v-Party vdem <- import_vdem() # Report missing values on a random subset of vdem test_that("missing observations are reported correctly", { expect_false(any(grepl("^n/a$", vdem[sample(nrow(vdem), 1000), ]))) expect_false(any(grepl("^N/A$", v...
# Introduction to R # # Rladies meetup May 24th # questions? amsterdam@rladies.org // ilsepit@gmail.com ############################################ SHORTCUTS ############################################ # this is a comment. Any symbols following '#' are for humans only. The interpreter will not use them. # if y...
/2018_May_IntrotoR-master/tutorial/tutorial1_RladiesMay2018.R
no_license
rladiesamsterdam/RLadiesMain
R
false
false
5,881
r
# Introduction to R # # Rladies meetup May 24th # questions? amsterdam@rladies.org // ilsepit@gmail.com ############################################ SHORTCUTS ############################################ # this is a comment. Any symbols following '#' are for humans only. The interpreter will not use them. # if y...
library(tidyverse) library(patchwork) library(Seurat) #loading data pbmc.data <- Read10X(data.dir = "C:/Users/tvb217/Documents/R/tmp/SCS/filtered_gene_bc_matrices/hg19/") pbmc <- CreateSeuratObject(counts = pbmc.data, project = "pbmc3k", min.cells = 3, min.features = 200) pbmc[["percent.mt"]] <- PercentageFeatureSet(p...
/sINGLE CELL TUTORIAL.R
no_license
Mortendall/SCS
R
false
false
3,598
r
library(tidyverse) library(patchwork) library(Seurat) #loading data pbmc.data <- Read10X(data.dir = "C:/Users/tvb217/Documents/R/tmp/SCS/filtered_gene_bc_matrices/hg19/") pbmc <- CreateSeuratObject(counts = pbmc.data, project = "pbmc3k", min.cells = 3, min.features = 200) pbmc[["percent.mt"]] <- PercentageFeatureSet(p...
# Group data by school group_by_school <- function(df_curr){ df_g <- df_curr %>% group_by(url) %>% summarize( progress_rating = mean(progress_rating, na.rm=T), test_score_rating = mean(test_score_rating, na.rm=T), equity_rating = mean(equity_rating, na.rm=T), overall_rating = mean(ov...
/analysis/data_prep.R
no_license
ngillani/school-reviews-analysis
R
false
false
7,714
r
# Group data by school group_by_school <- function(df_curr){ df_g <- df_curr %>% group_by(url) %>% summarize( progress_rating = mean(progress_rating, na.rm=T), test_score_rating = mean(test_score_rating, na.rm=T), equity_rating = mean(equity_rating, na.rm=T), overall_rating = mean(ov...
# ui.R shinyUI(fluidPage( mainPanel( # Add a selectInput (with a proper id) that allows you to select a variable to map selectInput('mapvar', label = 'Map Variables', choices = list('Votes' = 'votes', 'Population' = 'population', 'Votes / Population' = 'ratio')), # Use plotlyOut...
/exercise-3/ui.R
permissive
sperng/m18-shiny
R
false
false
372
r
# ui.R shinyUI(fluidPage( mainPanel( # Add a selectInput (with a proper id) that allows you to select a variable to map selectInput('mapvar', label = 'Map Variables', choices = list('Votes' = 'votes', 'Population' = 'population', 'Votes / Population' = 'ratio')), # Use plotlyOut...
PREP_GEO_DATA <- function(geo_shapes, master_table){ # This function is written based on the package dplyr. # This function depends on the geo_shapes output of the # 'sormasdatagen::GetGeoData()' function, as well as the master_table output # of the 'GET_MASTER_TABLE.R' function. # This function ren...
/R/PREP_GEO_DATA.R
no_license
DavidSoSiZoch/SitRep
R
false
false
791
r
PREP_GEO_DATA <- function(geo_shapes, master_table){ # This function is written based on the package dplyr. # This function depends on the geo_shapes output of the # 'sormasdatagen::GetGeoData()' function, as well as the master_table output # of the 'GET_MASTER_TABLE.R' function. # This function ren...
## ----load-libraries------------------------------------------------------ # work with spatial data; sp package will load with rgdal. library(rgdal) # for metadata/attributes- vectors or rasters library(raster) # set working directory to earth-analytics dir # setwd("pathToDirHere") ## ----Import-Shapefile-----------...
/code/course-materials/earth-analytics/week-4/in-class/2016-12-06-spatial01-intro-vector-data-R.R
permissive
choldgraf/earthlab.github.io
R
false
false
2,941
r
## ----load-libraries------------------------------------------------------ # work with spatial data; sp package will load with rgdal. library(rgdal) # for metadata/attributes- vectors or rasters library(raster) # set working directory to earth-analytics dir # setwd("pathToDirHere") ## ----Import-Shapefile-----------...
library(DescTools) ### Name: Mean ### Title: (Weighted) Arithmetic Mean ### Aliases: Mean Mean.default Mean.Freq ### Keywords: univar ### ** Examples x <- c(0:10, 50) xm <- Mean(x) c(xm, Mean(x, trim = 0.10))
/data/genthat_extracted_code/DescTools/examples/Mean.Rd.R
no_license
surayaaramli/typeRrh
R
false
false
222
r
library(DescTools) ### Name: Mean ### Title: (Weighted) Arithmetic Mean ### Aliases: Mean Mean.default Mean.Freq ### Keywords: univar ### ** Examples x <- c(0:10, 50) xm <- Mean(x) c(xm, Mean(x, trim = 0.10))
# Compile results after EMMAX analysis to save as a GRanges Rdata object and flat text file for compression and # archiving. library(here) library(readr) library(dplyr) library(magrittr) library(GenomicRanges) # library(rtracklayer) # library(liftOver) library(mikelaffr) #date.prefix <- format(Sys.time(), "%Y%m%d") #...
/src/conditionally_independent_eqtls/fdr10percent/06.1_compile_results.R
no_license
mikelaff/mirna-eqtl-manuscript
R
false
false
7,594
r
# Compile results after EMMAX analysis to save as a GRanges Rdata object and flat text file for compression and # archiving. library(here) library(readr) library(dplyr) library(magrittr) library(GenomicRanges) # library(rtracklayer) # library(liftOver) library(mikelaffr) #date.prefix <- format(Sys.time(), "%Y%m%d") #...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/GeoLight.R \name{staroddiTrans} \alias{staroddiTrans} \title{Transformation of staroddi files} \usage{ staroddiTrans(file) } \arguments{ \item{file}{the full patch and filename of the staroddi file.} } \value{ A \code{data.frame} suitable for...
/man/staroddiTrans.Rd
no_license
slisovski/GeoLight
R
false
true
512
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/GeoLight.R \name{staroddiTrans} \alias{staroddiTrans} \title{Transformation of staroddi files} \usage{ staroddiTrans(file) } \arguments{ \item{file}{the full patch and filename of the staroddi file.} } \value{ A \code{data.frame} suitable for...
#' Example 1: Estimate the labeller's uncertainty. #' #' load data source("../example2_combined/data.R") #' load labellers: source("labellers.R") source("../example2_combined/labellers.R") co <- c(1.7,-1) ro <- 1.4 oracle <- create_oracle_with_hole(data, co, ro, 0.001, 30) #' the fitting of NB with gaussian component...
/examples/example1_vector_response/old/example1_vector_response_labeller.R
no_license
antiphon/active-learning
R
false
false
1,392
r
#' Example 1: Estimate the labeller's uncertainty. #' #' load data source("../example2_combined/data.R") #' load labellers: source("labellers.R") source("../example2_combined/labellers.R") co <- c(1.7,-1) ro <- 1.4 oracle <- create_oracle_with_hole(data, co, ro, 0.001, 30) #' the fitting of NB with gaussian component...
library(readr) library(dplyr) library(caret) dataset <- read_csv("data/base_crabs.csv") set.seed(1234) index <- createDataPartition(dataset$class, p=0.70, list=FALSE) trainData = dataset[index,] testData = dataset[-index,] y_test <- matrix(table(1:60,testData$class), nrow=60, ncol=2) model_knn = train(trainData[2:8...
/Project2/crabs/knn.R
no_license
pmorvalho/ist-SAD
R
false
false
1,942
r
library(readr) library(dplyr) library(caret) dataset <- read_csv("data/base_crabs.csv") set.seed(1234) index <- createDataPartition(dataset$class, p=0.70, list=FALSE) trainData = dataset[index,] testData = dataset[-index,] y_test <- matrix(table(1:60,testData$class), nrow=60, ncol=2) model_knn = train(trainData[2:8...
# inner variables in_log_default <- quote(if(any('log_arg' %in% ls())&&is.list(log_arg))log_arg) in_msg1 <- 'data frame degraded to vector, use df[ , , drop=FALSE]' # I'm very interested in knowing your opinion of log files. ## Please let me know it at https://github.com/sherrisherry/cleandata/issues ## Even i...
/R/internal.R
no_license
cran/cleandata
R
false
false
1,491
r
# inner variables in_log_default <- quote(if(any('log_arg' %in% ls())&&is.list(log_arg))log_arg) in_msg1 <- 'data frame degraded to vector, use df[ , , drop=FALSE]' # I'm very interested in knowing your opinion of log files. ## Please let me know it at https://github.com/sherrisherry/cleandata/issues ## Even i...
############################################################################### ## Implementation of Maximum Likelihood estimation in i.i.d. setup ############################################################################### ## Maximum-Likelihood estimator MLEstimator <- function(x, ParamFamily, startPar = NU...
/R/MLEstimator.R
no_license
cran/distrMod
R
false
false
2,701
r
############################################################################### ## Implementation of Maximum Likelihood estimation in i.i.d. setup ############################################################################### ## Maximum-Likelihood estimator MLEstimator <- function(x, ParamFamily, startPar = NU...
test_that("multiplication works", { expect_equal(cube(2), 8) })
/tests/testthat/test-cube.R
permissive
nuno-agostinho/poweR
R
false
false
66
r
test_that("multiplication works", { expect_equal(cube(2), 8) })
# required rows first_row <- 66638 last_row <- 69517 # column names column_names <- c('Date', 'Time', 'Global_active_power', 'Global_reactive_power', 'Voltage', 'Global_intensity', 'Sub_metering_1', ...
/plot4.R
no_license
eipromb/ExData_Plotting1
R
false
false
1,869
r
# required rows first_row <- 66638 last_row <- 69517 # column names column_names <- c('Date', 'Time', 'Global_active_power', 'Global_reactive_power', 'Voltage', 'Global_intensity', 'Sub_metering_1', ...
dataset = as.character(commandArgs(trailingOnly = T)[1]) ## sc_10x_5cl source('/home-4/whou10@jhu.edu/scratch/Wenpin/resource/function.R') library(RColorBrewer) allmtd = list.files(paste0('/home-4/whou10@jhu.edu/scratch/Wenpin/rna_imputation/nullDE/result/',dataset,'/diff/wilcox/')) df <- sapply(allmtd, function(mtd){ ...
/nullDE/plot/code/02.1_wilcox_hm_pd.R
no_license
wangdi2016/imputationBenchmark
R
false
false
1,588
r
dataset = as.character(commandArgs(trailingOnly = T)[1]) ## sc_10x_5cl source('/home-4/whou10@jhu.edu/scratch/Wenpin/resource/function.R') library(RColorBrewer) allmtd = list.files(paste0('/home-4/whou10@jhu.edu/scratch/Wenpin/rna_imputation/nullDE/result/',dataset,'/diff/wilcox/')) df <- sapply(allmtd, function(mtd){ ...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/attr_access.R \name{get_leaves_branches_col} \alias{get_leaves_branches_col} \title{Get the colors of the branches of a dendrogram's leaves} \usage{ get_leaves_branches_col(dend, ...) } \arguments{ \item{dend}{a dendrogram object} \item{...}...
/man/get_leaves_branches_col.Rd
no_license
CathG/dendextend
R
false
true
1,329
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/attr_access.R \name{get_leaves_branches_col} \alias{get_leaves_branches_col} \title{Get the colors of the branches of a dendrogram's leaves} \usage{ get_leaves_branches_col(dend, ...) } \arguments{ \item{dend}{a dendrogram object} \item{...}...
bike[7,2] daily<- bike[1:10,bike$cyc_freq == 'Daily'] # Find the number of students in the dataset bike <- BikeData table(bike$student) student <- bike[bike$student == '1',] table(student$cyc_freq) distance <- student$distance mean(distance) daily <- bike[bike$cyc_freq== 'Daily',] table(daily$gender) mean(daily$age) ...
/technical_analysis-master/summer_2019/foundations_data_analysis/exe-week1.r
permissive
karansoneja/DataScience
R
false
false
458
r
bike[7,2] daily<- bike[1:10,bike$cyc_freq == 'Daily'] # Find the number of students in the dataset bike <- BikeData table(bike$student) student <- bike[bike$student == '1',] table(student$cyc_freq) distance <- student$distance mean(distance) daily <- bike[bike$cyc_freq== 'Daily',] table(daily$gender) mean(daily$age) ...
library(tidyverse) library(cowplot) res <- readRDS("data-raw/res_Aug_complete.rds") num_weeks <- 43 num_sims <- 5000 res <- res %>% filter(max_quar_delay=="1") res <- res %>% filter(test_delay=="2") res <- res %>% filter(sensitivity=="0.65") res <- res %>% filter(precaution=="0") res_low <- res %>% filter(index_R0==...
/R/AdditionalAnalysis.R
permissive
timcdlucas/ringbp
R
false
false
10,301
r
library(tidyverse) library(cowplot) res <- readRDS("data-raw/res_Aug_complete.rds") num_weeks <- 43 num_sims <- 5000 res <- res %>% filter(max_quar_delay=="1") res <- res %>% filter(test_delay=="2") res <- res %>% filter(sensitivity=="0.65") res <- res %>% filter(precaution=="0") res_low <- res %>% filter(index_R0==...
#!/usr/bin/Rscript ### ### This script reads in satellite data (as GeoTIFF files) of elevation ### and forest cover, visualises these and converts them into a map file ### for the GeMM model. ### ### (c) Daniel Vedder 2020 ### Licensed under the terms of the MIT license. ### library(rgdal) library(raster) library(RSto...
/examples/zosterops/map_creator.R
permissive
lleiding/gemm
R
false
false
4,887
r
#!/usr/bin/Rscript ### ### This script reads in satellite data (as GeoTIFF files) of elevation ### and forest cover, visualises these and converts them into a map file ### for the GeMM model. ### ### (c) Daniel Vedder 2020 ### Licensed under the terms of the MIT license. ### library(rgdal) library(raster) library(RSto...
\name{NISTjouleTOcalthKg} \alias{NISTjouleTOcalthKg} \title{Convert joule to calorieth , kilogram 11} \usage{NISTjouleTOcalthKg(joule)} \description{\code{NISTjouleTOcalthKg} converts from joule (J) to calorieth , kilogram (nutrition) 11 } \arguments{ \item{joule}{joule (J) } } \value{calorieth , kilogram (nutrition...
/man/NISTjouleTOcalthKg.Rd
no_license
cran/NISTunits
R
false
false
791
rd
\name{NISTjouleTOcalthKg} \alias{NISTjouleTOcalthKg} \title{Convert joule to calorieth , kilogram 11} \usage{NISTjouleTOcalthKg(joule)} \description{\code{NISTjouleTOcalthKg} converts from joule (J) to calorieth , kilogram (nutrition) 11 } \arguments{ \item{joule}{joule (J) } } \value{calorieth , kilogram (nutrition...
# CONTRASTS contrasts.fit <- function(fit,contrasts=NULL,coefficients=NULL) # Convert coefficients and std deviations in fit object to reflect contrasts of interest # Note: does not completely take probe-wise weights into account # because this would require refitting the linear model for each probe # Gordon Sm...
/R/contrasts.R
no_license
javrodriguez/limma
R
false
false
3,884
r
# CONTRASTS contrasts.fit <- function(fit,contrasts=NULL,coefficients=NULL) # Convert coefficients and std deviations in fit object to reflect contrasts of interest # Note: does not completely take probe-wise weights into account # because this would require refitting the linear model for each probe # Gordon Sm...
# # Copyright 2007-2016 The OpenMx Project # # 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/licenses/LICENSE-2.0 # # Unless required by applicable ...
/R/MxFlatSearchReplace.R
permissive
falkcarl/OpenMx
R
false
false
5,275
r
# # Copyright 2007-2016 The OpenMx Project # # 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/licenses/LICENSE-2.0 # # Unless required by applicable ...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/ma_r_ic.R \name{.refine_var_rr} \alias{.refine_var_rr} \title{Range-restriction refinement factor (i.e., "a") for correlations' corrected sampling variances} \usage{ .refine_var_rr( rxyi, ux, rxx = NULL, indirect_rr = rep(TRUE, length...
/man/dot-refine_var_rr.Rd
no_license
psychmeta/psychmeta
R
false
true
1,491
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/ma_r_ic.R \name{.refine_var_rr} \alias{.refine_var_rr} \title{Range-restriction refinement factor (i.e., "a") for correlations' corrected sampling variances} \usage{ .refine_var_rr( rxyi, ux, rxx = NULL, indirect_rr = rep(TRUE, length...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bio_funs.R \name{biochem_read} \alias{biochem_read} \title{Convenience function for aggregating the mean for biochemistry records} \usage{ biochem_read(udi, thename) } \arguments{ \item{udi}{UKB field number} \item{thename}{character string,...
/man/biochem_read.Rd
no_license
CelMcC/UKBTools
R
false
true
476
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bio_funs.R \name{biochem_read} \alias{biochem_read} \title{Convenience function for aggregating the mean for biochemistry records} \usage{ biochem_read(udi, thename) } \arguments{ \item{udi}{UKB field number} \item{thename}{character string,...
ms_prepdat <- function (timesmat, statusmat, id, starting_time, starting_state, transitionmat, original_states, longmat) { if (is.null(nrow(timesmat))) return(longmat) if (nrow(timesmat) == 0) return(longmat) from_states <- apply(!is.na(transitionmat), 2, sum) to_states <- apply(...
/Development/Dev_Local_GP/MS_CR/prepdat.R
no_license
drizopoulos/JMbayes2
R
false
false
4,698
r
ms_prepdat <- function (timesmat, statusmat, id, starting_time, starting_state, transitionmat, original_states, longmat) { if (is.null(nrow(timesmat))) return(longmat) if (nrow(timesmat) == 0) return(longmat) from_states <- apply(!is.na(transitionmat), 2, sum) to_states <- apply(...
boxplot(abs(m.radiosonde$error), abs(m.aeronet$error), abs(m.ar$error), outline = FALSE, names=c('G-R', 'G-A', 'A-R')) grid() boxplot(m.radiosonde$error, m.aeronet$error, m.ar$error, outline = FALSE, names=c('G-R', 'G-A', 'A-R')) grid()
/src/boxplots.R
permissive
xmd-sysu/IWVComparison
R
false
false
237
r
boxplot(abs(m.radiosonde$error), abs(m.aeronet$error), abs(m.ar$error), outline = FALSE, names=c('G-R', 'G-A', 'A-R')) grid() boxplot(m.radiosonde$error, m.aeronet$error, m.ar$error, outline = FALSE, names=c('G-R', 'G-A', 'A-R')) grid()
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/combine_pathways.R \name{combine_pathways} \alias{combine_pathways} \title{Calculate the probability of arrival across pathways} \usage{ combine_pathways(x, outfile, return_rast = FALSE) } \arguments{ \item{x}{Either a \code{RasterStack} or a...
/man/combine_pathways.Rd
no_license
jscamac/edmaps
R
false
true
1,151
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/combine_pathways.R \name{combine_pathways} \alias{combine_pathways} \title{Calculate the probability of arrival across pathways} \usage{ combine_pathways(x, outfile, return_rast = FALSE) } \arguments{ \item{x}{Either a \code{RasterStack} or a...
library(tidyr) library(dplyr) library(tigris) library(purrr) ## state and county spatial and lookup tables --------------------- # based on: https://www.datascienceriot.com/mapping-us-counties-in-r-with-fips/kris/ # download shape files county_sp <- counties(cb = TRUE, year = 2014, resolution = '20m') state_sp <- st...
/process_data.R
no_license
mndrake/leaflet-demo
R
false
false
2,504
r
library(tidyr) library(dplyr) library(tigris) library(purrr) ## state and county spatial and lookup tables --------------------- # based on: https://www.datascienceriot.com/mapping-us-counties-in-r-with-fips/kris/ # download shape files county_sp <- counties(cb = TRUE, year = 2014, resolution = '20m') state_sp <- st...
#the star-third componetnt eblup.mse.f.c3.star <- function(lme.obj, asympt.var.covar#=lme.obj$apVar , n.i, mean.resid.i,...){ var.v <- as.numeric(VarCorr(lme.obj)[,1])[1] var.e <- as.numeric(VarCorr(lme.obj)[,1])[2] #approx covariances - is that right? ## V.bar.vv <- l...
/R/eblup.mse.f.c3.star.R
no_license
cran/JoSAE
R
false
false
1,067
r
#the star-third componetnt eblup.mse.f.c3.star <- function(lme.obj, asympt.var.covar#=lme.obj$apVar , n.i, mean.resid.i,...){ var.v <- as.numeric(VarCorr(lme.obj)[,1])[1] var.e <- as.numeric(VarCorr(lme.obj)[,1])[2] #approx covariances - is that right? ## V.bar.vv <- l...
library(tidyverse) # Read in twitter credentials library(yaml) twitter_credentials <- yaml.load_file('../../../credentials/credentials.yaml') ## load rtweet package library(rtweet) token <- create_token( app = "bcndata", consumer_key = twitter_credentials$twitter_api_key, consumer_secret = twitter_credentials$twi...
/analyses/misc/scratch.R
permissive
LenzoM/vilaweb
R
false
false
13,637
r
library(tidyverse) # Read in twitter credentials library(yaml) twitter_credentials <- yaml.load_file('../../../credentials/credentials.yaml') ## load rtweet package library(rtweet) token <- create_token( app = "bcndata", consumer_key = twitter_credentials$twitter_api_key, consumer_secret = twitter_credentials$twi...
## Put comments here that give an overall description of what your ## functions do ## Write a short comment describing this function makeCacheMatrix <- function(x = matrix()) { cachedInverse <- NULL set <- function(y) { x <<- y cachedInverse <<- NULL ...
/cachematrix.R
no_license
412418908/ProgrammingAssignment2
R
false
false
956
r
## Put comments here that give an overall description of what your ## functions do ## Write a short comment describing this function makeCacheMatrix <- function(x = matrix()) { cachedInverse <- NULL set <- function(y) { x <<- y cachedInverse <<- NULL ...
\name{ReadFromFile} \alias{ReadFromFile} \title{ Reads data structure from file } \description{ Reads the data structure containing beat positions and all derived calculations from file } \usage{ ReadFromFile(name, verbose=FALSE) } \arguments{ \item{name}{ The name of the file to be used (without the .hrv extension...
/man/ReadFromFile.Rd
no_license
cran/RHRV
R
false
false
836
rd
\name{ReadFromFile} \alias{ReadFromFile} \title{ Reads data structure from file } \description{ Reads the data structure containing beat positions and all derived calculations from file } \usage{ ReadFromFile(name, verbose=FALSE) } \arguments{ \item{name}{ The name of the file to be used (without the .hrv extension...
# BRTE cover modeled as zero inflated beta # cover proportions collected on 1x1 m quadrats library(rjags) load.module('dic') library(mcmcplots) library(postjags) library(ggplot2) library(dplyr) # logit and antilogit functions logit <- function(x) { log(x/(1-x)) } ilogit <- function(x){ exp(x) / (1 + exp(x)) } # ...
/models/cover/BRTE/mono/BRTE_cover.R
permissive
cct-datascience/rangeland-restore
R
false
false
6,678
r
# BRTE cover modeled as zero inflated beta # cover proportions collected on 1x1 m quadrats library(rjags) load.module('dic') library(mcmcplots) library(postjags) library(ggplot2) library(dplyr) # logit and antilogit functions logit <- function(x) { log(x/(1-x)) } ilogit <- function(x){ exp(x) / (1 + exp(x)) } # ...
build<- function(fileName,bld="PAGE",docs=FALSE) {# BUILD: PAGE, ENTIRE, SCRIPT if(bld=="PAGE" & docs ==FALSE) { library(knitr) rmarkdown::render_site(paste(fileName, ".Rmd",sep=""))# build website } else if(bld=="ENTIRE" & docs ==FALSE) { library...
/_archive/_build.R
no_license
mcolvin/gcpo-lcc
R
false
false
2,988
r
build<- function(fileName,bld="PAGE",docs=FALSE) {# BUILD: PAGE, ENTIRE, SCRIPT if(bld=="PAGE" & docs ==FALSE) { library(knitr) rmarkdown::render_site(paste(fileName, ".Rmd",sep=""))# build website } else if(bld=="ENTIRE" & docs ==FALSE) { library...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/humarray.R \name{rs.to.id} \alias{rs.to.id} \title{Convert from dbSNP rs-ids to chip ID labels} \usage{ rs.to.id(rs.ids, manifest = FALSE, multi.list = TRUE, force.flat = TRUE) } \arguments{ \item{rs.ids}{character, meant to be a list of rs-i...
/man/rs.to.id.Rd
no_license
cran/humarray
R
false
true
2,554
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/humarray.R \name{rs.to.id} \alias{rs.to.id} \title{Convert from dbSNP rs-ids to chip ID labels} \usage{ rs.to.id(rs.ids, manifest = FALSE, multi.list = TRUE, force.flat = TRUE) } \arguments{ \item{rs.ids}{character, meant to be a list of rs-i...
# Power demo function ## Create graph with two normal pdf's showing alpha, beta and power power.graph <- function(hmean = 50, sigma = 10, n = 5, diff = 10, alpha = 0.05, tails = 1) { sd = sigma ...
/PowerGraphs.R
no_license
PLS120BookTeam/PLS120Book2018
R
false
false
3,888
r
# Power demo function ## Create graph with two normal pdf's showing alpha, beta and power power.graph <- function(hmean = 50, sigma = 10, n = 5, diff = 10, alpha = 0.05, tails = 1) { sd = sigma ...
#' Mockup a Route #' #' Creates a mockup of a route object. A mockup simulates what sort of response #' is generated by a route given a method, uri, and headers (optional). #' #' @param r A route object. #' #' @details #' #' Unfortunately, \code{httpuv} requires a least one header is specified. #' Therefore, \code{head...
/R/mockup.R
no_license
nteetor/prairie
R
false
false
2,816
r
#' Mockup a Route #' #' Creates a mockup of a route object. A mockup simulates what sort of response #' is generated by a route given a method, uri, and headers (optional). #' #' @param r A route object. #' #' @details #' #' Unfortunately, \code{httpuv} requires a least one header is specified. #' Therefore, \code{head...
#if (require(devtools)) install.packages("devtools")#if not already installed #devtools::install_github("AnalytixWare/ShinySky") #library(shinysky) #shinysky::run.shinysky.example() rm(list = ls()) library(shiny) library(xts) library(DT) library(quantmod) library(tidyquant) library(shinysky) library(ggplot2) library(P...
/Portfolio_Analytics/Shiny_Portfolio_X/app.R
no_license
DannyJRa/Portfolio_Analytics
R
false
false
2,783
r
#if (require(devtools)) install.packages("devtools")#if not already installed #devtools::install_github("AnalytixWare/ShinySky") #library(shinysky) #shinysky::run.shinysky.example() rm(list = ls()) library(shiny) library(xts) library(DT) library(quantmod) library(tidyquant) library(shinysky) library(ggplot2) library(P...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/f7Accordion.R \name{f7Accordion} \alias{f7Accordion} \alias{f7AccordionItem} \alias{updateF7Accordion} \title{Framework7 accordion container} \usage{ f7Accordion(..., id = NULL, multiCollapse = FALSE) f7AccordionItem(..., title = NULL, open ...
/man/accordion.Rd
no_license
RinteRface/shinyMobile
R
false
true
2,862
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/f7Accordion.R \name{f7Accordion} \alias{f7Accordion} \alias{f7AccordionItem} \alias{updateF7Accordion} \title{Framework7 accordion container} \usage{ f7Accordion(..., id = NULL, multiCollapse = FALSE) f7AccordionItem(..., title = NULL, open ...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/text.table.R \name{str_count_nomatch} \alias{str_count_nomatch} \title{Count the words in a vector that are not found in another vector.} \usage{ str_count_nomatch(x, y, ratio = FALSE) } \arguments{ \item{x}{A vector of words.} \item{y}{A ve...
/man/str_count_nomatch.Rd
no_license
cran/textTools
R
false
true
837
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/text.table.R \name{str_count_nomatch} \alias{str_count_nomatch} \title{Count the words in a vector that are not found in another vector.} \usage{ str_count_nomatch(x, y, ratio = FALSE) } \arguments{ \item{x}{A vector of words.} \item{y}{A ve...
# code to install packages in the docker file install.packages("tidyverse") install.packages("lubridate") install.packages("ReinforcementLearning") install.packages("magrittr") install.packages("plotly") install.packages("openssl") install.packages("rvest") install.packages("qdap") install.packages("stringr") ...
/02_code/install_packages.R
permissive
yoshiokiyamusu/docker-r-h2o
R
false
false
1,121
r
# code to install packages in the docker file install.packages("tidyverse") install.packages("lubridate") install.packages("ReinforcementLearning") install.packages("magrittr") install.packages("plotly") install.packages("openssl") install.packages("rvest") install.packages("qdap") install.packages("stringr") ...
# Libraries library(Seurat) library(ggplot2) library(AUCell) library(dplyr) # geneSets can take character vector or list if multiple signatures. # Extract expression matrix from Seurat object (monocyte) misc.mono <- readRDS("shared/pbmc_2.0/misc_integrated_object_2.0_updated_cond.rds") # Subset Seurat; needs to be ...
/A1/AUCell_type_I_ifn.R
no_license
iyalue/MIS-C_scRNAseq
R
false
false
7,127
r
# Libraries library(Seurat) library(ggplot2) library(AUCell) library(dplyr) # geneSets can take character vector or list if multiple signatures. # Extract expression matrix from Seurat object (monocyte) misc.mono <- readRDS("shared/pbmc_2.0/misc_integrated_object_2.0_updated_cond.rds") # Subset Seurat; needs to be ...
dat<-read.table("qry_pheno_Cotwin_421.csv" , header=T, sep=",", na.strings = "NA") tab<-aggregate(dat[,2:207],by=list(dat$UniqueID),FUN = mean, na.rm=TRUE) write.csv(tab, "tw2_avg.csv", row.names = F) dat2<-read.table("Query1.csv" , header=T, sep=",", na.strings = "NA") tab2<-aggregate(dat2[,...
/heatmap.R
no_license
Cailu086Lin/GTEX_data
R
false
false
720
r
dat<-read.table("qry_pheno_Cotwin_421.csv" , header=T, sep=",", na.strings = "NA") tab<-aggregate(dat[,2:207],by=list(dat$UniqueID),FUN = mean, na.rm=TRUE) write.csv(tab, "tw2_avg.csv", row.names = F) dat2<-read.table("Query1.csv" , header=T, sep=",", na.strings = "NA") tab2<-aggregate(dat2[,...
library(tidyverse) library(fastDummies) library(nonlinearICP) library(CondIndTests) bikes <- read_csv('../../data/london-bikes.csv') %>% mutate( season = as.factor(season), weather_code = as.factor(weather_code), hr = as.numeric(format(timestamp, '%H')) ) %>% sample_n(5000) X <- bikes %>% select(-...
/experiments/invariant-causal-prediction/7-icp-on-london-bikeshare.R
no_license
fastforwardlabs/causal-experiments
R
false
false
649
r
library(tidyverse) library(fastDummies) library(nonlinearICP) library(CondIndTests) bikes <- read_csv('../../data/london-bikes.csv') %>% mutate( season = as.factor(season), weather_code = as.factor(weather_code), hr = as.numeric(format(timestamp, '%H')) ) %>% sample_n(5000) X <- bikes %>% select(-...
#' Datensatz mit Rechtsakten finalisieren #' #' @param dt.rechtsakte Data.table. Der fast-finale Datensatz mit den Rechtsakten. #' @param lingstats Data.table. Die linguistischen Kennzahlen für die Rechtsakte. #' #' @return Data.table. Der finalisierte und geprüfte Datensatz. f.finalize_rechtsakte <- function(dt.re...
/functions/f.finalize_rechtsakte.R
permissive
SeanFobbe/c-dbr
R
false
false
2,015
r
#' Datensatz mit Rechtsakten finalisieren #' #' @param dt.rechtsakte Data.table. Der fast-finale Datensatz mit den Rechtsakten. #' @param lingstats Data.table. Die linguistischen Kennzahlen für die Rechtsakte. #' #' @return Data.table. Der finalisierte und geprüfte Datensatz. f.finalize_rechtsakte <- function(dt.re...
get_loading <- function(A, scores){ tt <- scale(scores, scale = apply(scores, 2, crossprod)) return(crossprod(A, tt)) } get_adj_weights <- function(x_loads, x_weights, nresp){ ncomp <- ncol(x_loads) if(ncomp == 1) {return(x_weights)} else { PW <- crossprod(x_loads, x_weigh...
/Source_code/coef.R
no_license
camilobroc/BMC_joint_sgPLS
R
false
false
8,443
r
get_loading <- function(A, scores){ tt <- scale(scores, scale = apply(scores, 2, crossprod)) return(crossprod(A, tt)) } get_adj_weights <- function(x_loads, x_weights, nresp){ ncomp <- ncol(x_loads) if(ncomp == 1) {return(x_weights)} else { PW <- crossprod(x_loads, x_weigh...
flights <- read.csv('2008.csv') library(stringr) library(chron) library(Hmisc) dep_time <- str_pad(flights$DepTime, 4, pad = "0") hour <- substring(dep_time,1,2) minutes <- substring(dep_time,3,4) for(i in 1:length(dep_time)){ dep_time[i] <- paste(c(hour[i],minutes[i],'00'),collapse = ':') } dep_time <- chron(times=...
/Descriptive Analytics-Part 3.R
no_license
VasTsak/r-exercises
R
false
false
2,715
r
flights <- read.csv('2008.csv') library(stringr) library(chron) library(Hmisc) dep_time <- str_pad(flights$DepTime, 4, pad = "0") hour <- substring(dep_time,1,2) minutes <- substring(dep_time,3,4) for(i in 1:length(dep_time)){ dep_time[i] <- paste(c(hour[i],minutes[i],'00'),collapse = ':') } dep_time <- chron(times=...
#Read the whole dataset and format columns dataset <- read.table("household_power_consumption.txt",header = TRUE, sep = ";", na="?") dataset$Time <- strptime(paste(dataset$Date, dataset$Time),"%d/%m/%Y %H:%M:%S") dataset$Date <- as.Date(dataset$Date,"%d/%m/%Y") #Subset the target rows selectedRows <- as.Date(c("...
/plot4.R
no_license
figoeric/ExData_Plotting1
R
false
false
1,207
r
#Read the whole dataset and format columns dataset <- read.table("household_power_consumption.txt",header = TRUE, sep = ";", na="?") dataset$Time <- strptime(paste(dataset$Date, dataset$Time),"%d/%m/%Y %H:%M:%S") dataset$Date <- as.Date(dataset$Date,"%d/%m/%Y") #Subset the target rows selectedRows <- as.Date(c("...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/extract_temporal_raster_values.R \name{extract_temporal_raster_values} \alias{extract_temporal_raster_values} \title{Extracts raster values from a set of rasters in the temporal_raster_df} \usage{ extract_temporal_raster_values(temporal_raste...
/man/extract_temporal_raster_values.Rd
no_license
danamelamed/swnsmodelr
R
false
true
544
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/extract_temporal_raster_values.R \name{extract_temporal_raster_values} \alias{extract_temporal_raster_values} \title{Extracts raster values from a set of rasters in the temporal_raster_df} \usage{ extract_temporal_raster_values(temporal_raste...
data <- read.csv(file=paste('./histdaily/', 'table_ebay.csv', sep=''), head=FALSE, sep=",", colClasses=c("myDate", "NULL", NA, "NULL", "NULL", "NULL", "NULL")) diff <- diff(data$V3) supervised = lag_transform(diff) N = nrow(supervised) train = supervised[1:N, ] test = supervised[1:N, ] Scaled = scale_data(train, test, ...
/checkpredictor.r
permissive
tumkit15/stocks
R
false
false
1,389
r
data <- read.csv(file=paste('./histdaily/', 'table_ebay.csv', sep=''), head=FALSE, sep=",", colClasses=c("myDate", "NULL", NA, "NULL", "NULL", "NULL", "NULL")) diff <- diff(data$V3) supervised = lag_transform(diff) N = nrow(supervised) train = supervised[1:N, ] test = supervised[1:N, ] Scaled = scale_data(train, test, ...
data("iris") source("DecisionTree.R") source("RandomForest.R") iris shuffled = iris[sample(nrow(iris)),] trainProportion = (60/100) * nrow(iris) train = shuffled[1:trainProportion,] test = shuffled[(trainProportion+1):nrow(shuffled),] Xtrain = train[,-ncol(train)] #Xtrain["Petal.Length.Int"] = as.factor(fl...
/examples/example2_iris.R
no_license
camillefossier/Random-Forest-Implementation
R
false
false
1,232
r
data("iris") source("DecisionTree.R") source("RandomForest.R") iris shuffled = iris[sample(nrow(iris)),] trainProportion = (60/100) * nrow(iris) train = shuffled[1:trainProportion,] test = shuffled[(trainProportion+1):nrow(shuffled),] Xtrain = train[,-ncol(train)] #Xtrain["Petal.Length.Int"] = as.factor(fl...
## Reading the dataset data <- read.table("household_power_consumption.txt", header = T, sep =";", na.strings = "?") ## Coverting Date variables to class type data$Date <- as.Date(data$Date, format = "%d/%m/%Y") ## Subsetting the data data <- subset(data, subset = (Date >= "2007-02-01" & Date <= "2007-02-02")) ## Conv...
/plot1.R
no_license
jeromelocson/ExData_Plotting1
R
false
false
641
r
## Reading the dataset data <- read.table("household_power_consumption.txt", header = T, sep =";", na.strings = "?") ## Coverting Date variables to class type data$Date <- as.Date(data$Date, format = "%d/%m/%Y") ## Subsetting the data data <- subset(data, subset = (Date >= "2007-02-01" & Date <= "2007-02-02")) ## Conv...
pacman::p_load(tidyverse) data_full <-read_csv("data/drugbank_target_parse.csv") clean_data <- data_full %>% mutate(Actions_mod = str_replace(Actions, '\\B([[:upper:]])', '_\\1')) %>% separate(Actions_mod, c("A", "B", "C"), sep = '_', fill = "right") %>% mutate( A = ifelse(Actions == "Other/u...
/src/preproc.R
no_license
uakimix/receptores
R
false
false
1,870
r
pacman::p_load(tidyverse) data_full <-read_csv("data/drugbank_target_parse.csv") clean_data <- data_full %>% mutate(Actions_mod = str_replace(Actions, '\\B([[:upper:]])', '_\\1')) %>% separate(Actions_mod, c("A", "B", "C"), sep = '_', fill = "right") %>% mutate( A = ifelse(Actions == "Other/u...
context("component test for DataStore") testthat::setup({ assign("test_env", testthat::test_env(), envir = parent.frame()) }) test_that("DataStore can be instantiated", { attach(test_env) expect_class(test_env$obj <- DataStore$new(), "DataStore") }) test_that("DataStore has access to the project datasets...
/tests/component-tests/test-DataStore.R
permissive
data-science-competitions/Modeling-Earthquake-Damage
R
false
false
612
r
context("component test for DataStore") testthat::setup({ assign("test_env", testthat::test_env(), envir = parent.frame()) }) test_that("DataStore can be instantiated", { attach(test_env) expect_class(test_env$obj <- DataStore$new(), "DataStore") }) test_that("DataStore has access to the project datasets...
#### author: Claudia Zapata (1124185) #install.packages("BBmisc") #install.packages("segmented") library(BBmisc) library(segmented) library(ggplot2) suicides = read.csv("TimeSeriesData.csv") ### General Function suicides_seg_reg = function(year, suicides, installation = NULL, breakpoints, study_name = NULL) { resu...
/Segmented Regression/Segmented Regression.R
no_license
Jo-Sin/CapstoneProject
R
false
false
5,707
r
#### author: Claudia Zapata (1124185) #install.packages("BBmisc") #install.packages("segmented") library(BBmisc) library(segmented) library(ggplot2) suicides = read.csv("TimeSeriesData.csv") ### General Function suicides_seg_reg = function(year, suicides, installation = NULL, breakpoints, study_name = NULL) { resu...
svmTrain<-function(trnData, trnLabel, C) { a=as.matrix(trnData,nrow=200) b=as.matrix(trnLabel,nrow=200) A=a %*% t(a) B=b %*% t(b) c=A * B a1=t(b) a2=(diag(200)) a3=(-diag(200)) A1=rbind(a1,a2,a3) A1=t(A1) z1=0 z2=matrix(rep(0,200)) z3=matrix(rep(-C,200)) Z=rbind(z1,z2,z3) c=c+(10 ^ (-12)*...
/SUPPORT_VECTOR/SVM.R
no_license
IDilantha/PATTERN_RECOGNITION_ALGORITHMS_IMPLEMENTATION
R
false
false
1,209
r
svmTrain<-function(trnData, trnLabel, C) { a=as.matrix(trnData,nrow=200) b=as.matrix(trnLabel,nrow=200) A=a %*% t(a) B=b %*% t(b) c=A * B a1=t(b) a2=(diag(200)) a3=(-diag(200)) A1=rbind(a1,a2,a3) A1=t(A1) z1=0 z2=matrix(rep(0,200)) z3=matrix(rep(-C,200)) Z=rbind(z1,z2,z3) c=c+(10 ^ (-12)*...
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 CalcGene <- function(s_data, seqAll, prodValue) { .Call('_HUM_CalcGene', PACKAGE = 'HUM', s_data, seqAll, prodValue) } CalcROC <- function(s_data, seq, thresholds) { .Call('_HU...
/R/RcppExports.R
no_license
cran/HUM
R
false
false
380
r
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 CalcGene <- function(s_data, seqAll, prodValue) { .Call('_HUM_CalcGene', PACKAGE = 'HUM', s_data, seqAll, prodValue) } CalcROC <- function(s_data, seq, thresholds) { .Call('_HU...
library(rstan) library(ggplot2) source("earnings1.data.R", echo = TRUE) ## Mixed discrete/continuous data # Logistic regression with interactions (earnings1.stan) # glm (earn.pos ~ height + male, family=binomial(link="logit")) dataList.1 <- c("N","earn_pos","height","male") earnings1.sf1 <- stan(file='earnings1....
/test/integration/example-models/ARM/Ch.6/6.7_MoreComplexGLM.R
permissive
nhuurre/stanc3
R
false
false
730
r
library(rstan) library(ggplot2) source("earnings1.data.R", echo = TRUE) ## Mixed discrete/continuous data # Logistic regression with interactions (earnings1.stan) # glm (earn.pos ~ height + male, family=binomial(link="logit")) dataList.1 <- c("N","earn_pos","height","male") earnings1.sf1 <- stan(file='earnings1....
#' Load a list from file #' #' @param file a \code{character} vector. The file as input. #' @param type The type of input which, by default, is determined #' by file extension. Currently supports RData, RDS, JSON, YAML. #' @param ... Additional parameters passed to the loader function #' @param guess a \code{charact...
/R/list.load.R
permissive
renkun-ken/rlist
R
false
false
3,514
r
#' Load a list from file #' #' @param file a \code{character} vector. The file as input. #' @param type The type of input which, by default, is determined #' by file extension. Currently supports RData, RDS, JSON, YAML. #' @param ... Additional parameters passed to the loader function #' @param guess a \code{charact...
d=read.csv("StatusCodes.txt",stringsAsFactors=F,header=FALSE,sep="\t") data=d[,1] newData=data[which(data<10)] png("StatusCodes-histogramNew2.png") hist(newData,main="StatusCodes Histogram",freq=T,xlab="Status Codes",ylab="Frequency") dev.off()
/Assignment1/Report/documentation/StatusCodesHistogram.R
permissive
bharath559/cs851-s15
R
false
false
249
r
d=read.csv("StatusCodes.txt",stringsAsFactors=F,header=FALSE,sep="\t") data=d[,1] newData=data[which(data<10)] png("StatusCodes-histogramNew2.png") hist(newData,main="StatusCodes Histogram",freq=T,xlab="Status Codes",ylab="Frequency") dev.off()
library(MatrixCorrelation) ### Name: PSI ### Title: Procrustes Similarity Index ### Aliases: PSI ### ** Examples X1 <- scale( matrix( rnorm(100*300), 100,300), scale = FALSE) usv <- svd(X1) X2 <- usv$u[,-3] %*% diag(usv$d[-3]) %*% t(usv$v[,-3]) PSI(X1,X2)
/data/genthat_extracted_code/MatrixCorrelation/examples/PSI.Rd.R
no_license
surayaaramli/typeRrh
R
false
false
266
r
library(MatrixCorrelation) ### Name: PSI ### Title: Procrustes Similarity Index ### Aliases: PSI ### ** Examples X1 <- scale( matrix( rnorm(100*300), 100,300), scale = FALSE) usv <- svd(X1) X2 <- usv$u[,-3] %*% diag(usv$d[-3]) %*% t(usv$v[,-3]) PSI(X1,X2)
######################################## DEFINED FUNCTIONS ############################################## ######################################## <FUNC_NAME> ############################################## ######################################## LOAD LIBRARIES ############################################## librar...
/def_functions.R
no_license
bentona/bayesian-portfolio
R
false
false
5,321
r
######################################## DEFINED FUNCTIONS ############################################## ######################################## <FUNC_NAME> ############################################## ######################################## LOAD LIBRARIES ############################################## librar...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/earthquakes_plotting.r \name{geom_timeline_label} \alias{geom_timeline_label} \title{Creating the geom -> geom_timeline_label()} \usage{ geom_timeline_label( mapping = NULL, data = NULL, stat = "identity", position = "identity", na....
/man/geom_timeline_label.Rd
permissive
MarcEres/Earthquakes
R
false
true
1,615
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/earthquakes_plotting.r \name{geom_timeline_label} \alias{geom_timeline_label} \title{Creating the geom -> geom_timeline_label()} \usage{ geom_timeline_label( mapping = NULL, data = NULL, stat = "identity", position = "identity", na....
library("MASS") library("dplyr") library("bootnet") library("psychonetrics") library("ggplot2") source("nw function.R") source("myplot.R") # ------ Create network matrices ------ # degree <- getnw("degree") close <- getnw("close") between <- getnw("between") alt <- getnw("alt") degree2 <- getnw("degree2") cl...
/simulation Preacher.R
no_license
sophieberkhout/thesis-edges-parsimony
R
false
false
4,402
r
library("MASS") library("dplyr") library("bootnet") library("psychonetrics") library("ggplot2") source("nw function.R") source("myplot.R") # ------ Create network matrices ------ # degree <- getnw("degree") close <- getnw("close") between <- getnw("between") alt <- getnw("alt") degree2 <- getnw("degree2") cl...
## Create one R script called run_analysis.R that does the following: ## 1. Merges the training and the test sets to create one data set. ## 2. Extracts only the measurements on the mean and standard deviation for each measurement. ## 3. Uses descriptive activity names to name the activities in the data set ## 4. Appro...
/run_analysis.R
no_license
gaspart/UciHarDataset
R
false
false
2,591
r
## Create one R script called run_analysis.R that does the following: ## 1. Merges the training and the test sets to create one data set. ## 2. Extracts only the measurements on the mean and standard deviation for each measurement. ## 3. Uses descriptive activity names to name the activities in the data set ## 4. Appro...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/lore.R \name{lore_is_itchy} \alias{lore_is_itchy} \title{Lore is itchy...} \usage{ lore_is_itchy() } \description{ Lore is itchy... }
/man/lore_is_itchy.Rd
no_license
luukvdmeer/loRe
R
false
true
212
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/lore.R \name{lore_is_itchy} \alias{lore_is_itchy} \title{Lore is itchy...} \usage{ lore_is_itchy() } \description{ Lore is itchy... }
### Exceedences (150916) Plots... data = OW6.Exceed names(OW6.Exceed) OW6.Excd.nam <- as.data.frame(names(OW6.Exceed)) # plot NH3 std x pH, add Exceeding values as separate symbol... NH3_std [59] pH [56] NH3_excd [60] ####### Not this one ##### q0 <- ggplot(data=subset(OW6.Exceed, NH3_excd = ""), aes(x=...
/WS_Code_ExceedncPlots_151016.R
no_license
TobyHooker/dataCleanup_scripts
R
false
false
1,845
r
### Exceedences (150916) Plots... data = OW6.Exceed names(OW6.Exceed) OW6.Excd.nam <- as.data.frame(names(OW6.Exceed)) # plot NH3 std x pH, add Exceeding values as separate symbol... NH3_std [59] pH [56] NH3_excd [60] ####### Not this one ##### q0 <- ggplot(data=subset(OW6.Exceed, NH3_excd = ""), aes(x=...
# Using the Titanic data set to determine if the passenger will survive or not # Decision Tree # 11/21/16 # Library for decision trees library(rpart) library(party) library(rattle) library(rpart.plot) library(RColorBrewer) # library(e1071) # Library for k-fold cross validation function library(caret) # L...
/JenDumiak/leoCouldHaveFit.R
no_license
HandsOnTheRope/-Data-Bullshark
R
false
false
4,236
r
# Using the Titanic data set to determine if the passenger will survive or not # Decision Tree # 11/21/16 # Library for decision trees library(rpart) library(party) library(rattle) library(rpart.plot) library(RColorBrewer) # library(e1071) # Library for k-fold cross validation function library(caret) # L...
#setClass("kernel",representation("function",kpar="list")) #setClass("kernelMatrix",representation("matrix"),prototype=structure(.Data=matrix())) setClassUnion("listI", c("list","numeric","vector","integer","matrix")) setClassUnion("output", c("matrix","factor","vector","logical","numeric","list","integer","NULL")) se...
/assets/scripts/4_MMA/_functions/aobject.R
permissive
BPRC-EcoInformatics/BPRC-EcoInformatics.github.io
R
false
false
10,417
r
#setClass("kernel",representation("function",kpar="list")) #setClass("kernelMatrix",representation("matrix"),prototype=structure(.Data=matrix())) setClassUnion("listI", c("list","numeric","vector","integer","matrix")) setClassUnion("output", c("matrix","factor","vector","logical","numeric","list","integer","NULL")) se...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/BiCopVuongClarke.R \name{BiCopVuongClarke} \alias{BiCopVuongClarke} \title{Scoring Goodness-of-Fit Test based on Vuong And Clarke Tests for Bivariate Copula Data} \usage{ BiCopVuongClarke( u1, u2, familyset = NA, correction = FALSE, ...
/man/BiCopVuongClarke.Rd
no_license
goldenwalden/VineCopula
R
false
true
6,549
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/BiCopVuongClarke.R \name{BiCopVuongClarke} \alias{BiCopVuongClarke} \title{Scoring Goodness-of-Fit Test based on Vuong And Clarke Tests for Bivariate Copula Data} \usage{ BiCopVuongClarke( u1, u2, familyset = NA, correction = FALSE, ...
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/saffeR.R \docType{package} \name{saffeR} \alias{saffeR} \alias{saffeR-package} \title{saffeR: Things relating to South Africa} \description{ The saffeR package provides a collection of data and functions for things relevant to South Africa. }...
/man/saffeR.Rd
no_license
aidaylanan/saffeR
R
false
true
321
rd
% Generated by roxygen2: do not edit by hand % Please edit documentation in R/saffeR.R \docType{package} \name{saffeR} \alias{saffeR} \alias{saffeR-package} \title{saffeR: Things relating to South Africa} \description{ The saffeR package provides a collection of data and functions for things relevant to South Africa. }...
UVB.q <- function(wavelengths){ hprime <- 3.990e-10 # J s / mol c <- 2.99792458e8 # m / s UVB.quantum <- UVB.e(wavelengths) / ( hprime * c / (wavelengths * 1e-9)) # um / m return(UVB.quantum) }
/UVcalc/R/UVB.q.R
no_license
aphalo/UVcalc
R
false
false
204
r
UVB.q <- function(wavelengths){ hprime <- 3.990e-10 # J s / mol c <- 2.99792458e8 # m / s UVB.quantum <- UVB.e(wavelengths) / ( hprime * c / (wavelengths * 1e-9)) # um / m return(UVB.quantum) }
#Libraries---------------------------------- library(excel.link); library(plyr); library(dplyr); library(ggplot2); library(tidyr); library(lubridate); library(stringr) library(rattle); library(scales); library(forcats); library(gridExtra) #Required Parameters------------------------ scenario_name <- c('RVAJR02_097') c...
/Component_Comparison/00_RVAJR_C05_EFDC_Data_Run_File.R
no_license
padilla410/EFDC_Results_Figures
R
false
false
2,312
r
#Libraries---------------------------------- library(excel.link); library(plyr); library(dplyr); library(ggplot2); library(tidyr); library(lubridate); library(stringr) library(rattle); library(scales); library(forcats); library(gridExtra) #Required Parameters------------------------ scenario_name <- c('RVAJR02_097') c...
testlist <- list(hi = 0, lo = 3.3789841210987e-318, mu = -4.91619384386698e+245, sig = -4.63135417605118e-282) result <- do.call(gjam:::tnormRcpp,testlist) str(result)
/gjam/inst/testfiles/tnormRcpp/libFuzzer_tnormRcpp/tnormRcpp_valgrind_files/1610046161-test.R
no_license
akhikolla/updated-only-Issues
R
false
false
172
r
testlist <- list(hi = 0, lo = 3.3789841210987e-318, mu = -4.91619384386698e+245, sig = -4.63135417605118e-282) result <- do.call(gjam:::tnormRcpp,testlist) str(result)
library(shiny) heart.train<-read.csv(file="train_values.csv") ui<-navbarPage("Machine learning with heart", tabPanel("Data Import",sidebarLayout(sidebarPanel( fileInput("file","Upload your CSV",multiple = FALSE), tags$hr(), ...
/hcldev.R
no_license
Devimeenu123/innovation_geeks
R
false
false
2,301
r
library(shiny) heart.train<-read.csv(file="train_values.csv") ui<-navbarPage("Machine learning with heart", tabPanel("Data Import",sidebarLayout(sidebarPanel( fileInput("file","Upload your CSV",multiple = FALSE), tags$hr(), ...