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 |
|---|---|---|---|---|---|---|---|---|---|
#' @rdname prediction
#' @export
prediction.arima0 <- prediction.ar
| /R/prediction_arima0.R | no_license | cran/prediction | R | false | false | 71 | r | #' @rdname prediction
#' @export
prediction.arima0 <- prediction.ar
|
#################################
# #
# ANOVA #
# ` #
#################################
# We use ANOVA if we have to comparing mean of more than 2 samples
# To compare mean, we have to look at it's variance
# We look the variance of each... | /anova.R | no_license | rifkinurfaiz/inferential-statistic | R | false | false | 2,092 | r | #################################
# #
# ANOVA #
# ` #
#################################
# We use ANOVA if we have to comparing mean of more than 2 samples
# To compare mean, we have to look at it's variance
# We look the variance of each... |
#' Get NOAA Stations.
#'
#' This function retrieves the NOAA stations.
#'
#'
#' @param localSave saves / retrieves information locally
#' @param refresh forces a refresh of cached station information
#' @param localFileName local name of file used to cache station information
#' @keywords coordinates
#' @examples
#... | /R/Functions_NOAA_Stations.R | permissive | JerryHMartin/waterDataSupport | R | false | false | 5,943 | r | #' Get NOAA Stations.
#'
#' This function retrieves the NOAA stations.
#'
#'
#' @param localSave saves / retrieves information locally
#' @param refresh forces a refresh of cached station information
#' @param localFileName local name of file used to cache station information
#' @keywords coordinates
#' @examples
#... |
#' @title Similarity of documents to a dictionary
#' @description Computes the cosinal similarity between the average word vector
#' representation of each document in a data frame and the average
#' word vector representation of a dictionary, using fasttext word vector model.
#' @details
#' Implements the method calle... | /R/cossim2dict.R | permissive | thieled/dictvectoR | R | false | false | 4,426 | r | #' @title Similarity of documents to a dictionary
#' @description Computes the cosinal similarity between the average word vector
#' representation of each document in a data frame and the average
#' word vector representation of a dictionary, using fasttext word vector model.
#' @details
#' Implements the method calle... |
################################################################################
### Helper functions for regression-based causal mediation analysis
##
## Created on: 2020-03-11
## Author: Kazuki Yoshida
################################################################################
###
### coef extractors
#########... | /R/06_calc_myreg_helpers_coef.R | no_license | kaz-yos/regmedint | R | false | false | 18,553 | r | ################################################################################
### Helper functions for regression-based causal mediation analysis
##
## Created on: 2020-03-11
## Author: Kazuki Yoshida
################################################################################
###
### coef extractors
#########... |
#
#
# Author: aagarwal
###############################################################################
# the data sheet is in PCU this time.
df = read.table(commandArgs()[3],header=FALSE,sep="\t")
png(commandArgs()[4],height=600,width=1000)
q = t(data.frame(df[,2:11]))
qmax = max(q)
print(qmax)
q = q/qmax
k=df[,... | /src/main/resources/R/insetPlot/boxPlot_inset.R | no_license | teg-iitr/matsim-iitr | R | false | false | 1,190 | r | #
#
# Author: aagarwal
###############################################################################
# the data sheet is in PCU this time.
df = read.table(commandArgs()[3],header=FALSE,sep="\t")
png(commandArgs()[4],height=600,width=1000)
q = t(data.frame(df[,2:11]))
qmax = max(q)
print(qmax)
q = q/qmax
k=df[,... |
CURD_DIR ?=../../../
CURD_CFLAGS ?=-I$(P4ROOT)/sw/gpgpu/samples/common/inc -v -keep -dr -rdc=true -I$(CURD_DIR) -lineinfo -arch=sm_35 --cudart=shared
CURD_FLAGS_LAZY=$(CURD_CFLAGS) -L$(CURD_DIR) $(CURD_DIR)/race_detection_lazy.o
CURD_FLAGS_EAGER=$(CURD_CFLAGS) -L$(CURD_DIR) $(CURD_DIR)/race_detection_eager.o
# Dete... | /benchmarks/rodinia/cfd/Makefile.rd | no_license | sljiaa/curd-llvm | R | false | false | 1,514 | rd | CURD_DIR ?=../../../
CURD_CFLAGS ?=-I$(P4ROOT)/sw/gpgpu/samples/common/inc -v -keep -dr -rdc=true -I$(CURD_DIR) -lineinfo -arch=sm_35 --cudart=shared
CURD_FLAGS_LAZY=$(CURD_CFLAGS) -L$(CURD_DIR) $(CURD_DIR)/race_detection_lazy.o
CURD_FLAGS_EAGER=$(CURD_CFLAGS) -L$(CURD_DIR) $(CURD_DIR)/race_detection_eager.o
# Dete... |
\name{contour.im}
\alias{contour.im}
\title{Contour plot of pixel image}
\description{
Generates a contour plot of a pixel image.
}
\usage{
\method{contour}{im}(x, \dots, main,
axes=FALSE, add=FALSE, col=par("fg"),
clipwin=NULL, show.all=!add, do.plot=TRUE)
}
\arguments{
\item{x}{
Pi... | /man/contour.im.Rd | no_license | rubak/spatstat | R | false | false | 3,314 | rd | \name{contour.im}
\alias{contour.im}
\title{Contour plot of pixel image}
\description{
Generates a contour plot of a pixel image.
}
\usage{
\method{contour}{im}(x, \dots, main,
axes=FALSE, add=FALSE, col=par("fg"),
clipwin=NULL, show.all=!add, do.plot=TRUE)
}
\arguments{
\item{x}{
Pi... |
covariancePriorsToString <- function(covPriors, numGroupsPerFactor, digits)
{
result <- character(0L)
resultIndex <- 1L
numFactors <- length(numGroupsPerFactor)
factorNames <- names(numGroupsPerFactor)
for (i in seq_len(numFactors)) {
prior.i <- covPriors[[i]]
if (is.null(prior.i)) next
resul... | /R/string.R | no_license | vdorie/blme | R | false | false | 1,144 | r | covariancePriorsToString <- function(covPriors, numGroupsPerFactor, digits)
{
result <- character(0L)
resultIndex <- 1L
numFactors <- length(numGroupsPerFactor)
factorNames <- names(numGroupsPerFactor)
for (i in seq_len(numFactors)) {
prior.i <- covPriors[[i]]
if (is.null(prior.i)) next
resul... |
library(testthat)
library(IETD)
test_check("IETD")
| /tests/testthat.R | no_license | cran/IETD | R | false | false | 56 | r | library(testthat)
library(IETD)
test_check("IETD")
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/format_data.R
\name{fmt_date}
\alias{fmt_date}
\title{Format values as dates}
\usage{
fmt_date(
data,
columns,
rows = everything(),
date_style = "iso",
pattern = "{x}",
locale = NULL
)
}
\arguments{
\item{data}{A table object that... | /man/fmt_date.Rd | permissive | steveputman/gt | R | false | true | 9,954 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/format_data.R
\name{fmt_date}
\alias{fmt_date}
\title{Format values as dates}
\usage{
fmt_date(
data,
columns,
rows = everything(),
date_style = "iso",
pattern = "{x}",
locale = NULL
)
}
\arguments{
\item{data}{A table object that... |
#' Plot a topological feature of network module
#'
#' Functions for plotting the topology of a network module.
#'
#' @inheritParams common_params
#' @inheritParams orderModules_param
#' @inheritParams plot_params
#'
#' @param symmetric logical; controls whether the correlation and network
#' heatmaps are drawn as s... | /R/plot-topology.R | no_license | rintukutum/NetRep | R | false | false | 58,014 | r | #' Plot a topological feature of network module
#'
#' Functions for plotting the topology of a network module.
#'
#' @inheritParams common_params
#' @inheritParams orderModules_param
#' @inheritParams plot_params
#'
#' @param symmetric logical; controls whether the correlation and network
#' heatmaps are drawn as s... |
library(describer)
context("describe() on vectors")
u <- c(TRUE, TRUE, FALSE, NA)
v <- c("A", "B", "B", NA_character_)
w <- c(0L, 1L, 2L, NA_integer_)
x <- c(5.1, 6.2, 7.3, NA_real_)
y <- seq.Date(from = as.Date("2011-01-01"),
to = as.Date("2011-07-01"),
length.out = 4)
z <- factor(c("AK", ... | /tests/testthat/test-describe-vectors.R | no_license | paulhendricks/describer | R | false | false | 625 | r | library(describer)
context("describe() on vectors")
u <- c(TRUE, TRUE, FALSE, NA)
v <- c("A", "B", "B", NA_character_)
w <- c(0L, 1L, 2L, NA_integer_)
x <- c(5.1, 6.2, 7.3, NA_real_)
y <- seq.Date(from = as.Date("2011-01-01"),
to = as.Date("2011-07-01"),
length.out = 4)
z <- factor(c("AK", ... |
# this function has the resposibility to generate a sense of a given text, and
# that will be related to Wordnet dictionaey
# collect the relavant data for dictonar for yhe context
# train your model and extract the relevant pattern
# # create dependencies trees and connect tpo wordnwet
# # train your model with th... | /semantics_gen.R | no_license | pranita-s/NLP | R | false | false | 3,744 | r | # this function has the resposibility to generate a sense of a given text, and
# that will be related to Wordnet dictionaey
# collect the relavant data for dictonar for yhe context
# train your model and extract the relevant pattern
# # create dependencies trees and connect tpo wordnwet
# # train your model with th... |
# -----------------------------------------------------------------------------------
# ---- Input Information ------------------------------------------------------------
# -----------------------------------------------------------------------------------
# set the path of where the input files are
mywd = "C:/ ... | /kmeans.R | no_license | N-ickMorris/Unsupervised-Machine-Learning | R | false | false | 18,718 | r | # -----------------------------------------------------------------------------------
# ---- Input Information ------------------------------------------------------------
# -----------------------------------------------------------------------------------
# set the path of where the input files are
mywd = "C:/ ... |
# LatticeKrig is a package for analysis of spatial data written for
# the R software environment .
# Copyright (C) 2016
# University Corporation for Atmospheric Research (UCAR)
# Contact: Douglas Nychka, nychka@ucar.edu,
# National Center for Atmospheric Research, PO Box 3000, Boulder, CO 80307-3000
#
# This program i... | /LatticeKrig8.0/R/LKRectangleFastNormalization.R | no_license | NCAR/LatticeKrig | R | false | false | 2,255 | r | # LatticeKrig is a package for analysis of spatial data written for
# the R software environment .
# Copyright (C) 2016
# University Corporation for Atmospheric Research (UCAR)
# Contact: Douglas Nychka, nychka@ucar.edu,
# National Center for Atmospheric Research, PO Box 3000, Boulder, CO 80307-3000
#
# This program i... |
# > xl
# [1] 98
# > xm
# [1] 9.899495
# >
x <- c(32, 41, 47, 53, 57)
xl <- var(x)
xm <- sd(x)
xl
xm
| /09chapt/page0470c.r | no_license | billwestfall/R | R | false | false | 103 | r | # > xl
# [1] 98
# > xm
# [1] 9.899495
# >
x <- c(32, 41, 47, 53, 57)
xl <- var(x)
xm <- sd(x)
xl
xm
|
## The following two functions (makeCacheMatrix, cacheSolve)
## work together to cache the inverse of a matrix so it does
## not have to be repeatedly calculated.
## The makeCacheMatrix function creates a special
## "matrix" object that can cache its inverse.
## The output is a list of functions that get and set
## t... | /cachematrix.R | no_license | SamanthaFoster/ProgrammingAssignment2 | R | false | false | 1,495 | r | ## The following two functions (makeCacheMatrix, cacheSolve)
## work together to cache the inverse of a matrix so it does
## not have to be repeatedly calculated.
## The makeCacheMatrix function creates a special
## "matrix" object that can cache its inverse.
## The output is a list of functions that get and set
## t... |
source('aaCheck.R')
#' @export instaIndex
#' @title Compute the instability index of a protein sequence
#' @description This function calculates the instability index proposed by Guruprasad (1990). This index predicts the stability of a protein based on its amino acid composition, a protein whose instability index is s... | /rpeptides/R/instaindex.R | no_license | grganjali/AMP-1 | R | false | false | 7,776 | r | source('aaCheck.R')
#' @export instaIndex
#' @title Compute the instability index of a protein sequence
#' @description This function calculates the instability index proposed by Guruprasad (1990). This index predicts the stability of a protein based on its amino acid composition, a protein whose instability index is s... |
####### WEEK 3 - NOTES
'''
CONDITIONS
- If-Else Conditions
- eg: gender columns, want to create dummy vars
- Gender : IS_MALE --> 1 0 for dummy var for male
- the rest of the vars are 0
- 2 conditions, can have 3 else
'''
# Create vector quantity
quantity <- 38
# Set the is-else statement
if ... | /Intro_to_Programming/WEEK_3_NOTES_R.R | no_license | priyaankasaxena/Notes | R | false | false | 8,307 | r | ####### WEEK 3 - NOTES
'''
CONDITIONS
- If-Else Conditions
- eg: gender columns, want to create dummy vars
- Gender : IS_MALE --> 1 0 for dummy var for male
- the rest of the vars are 0
- 2 conditions, can have 3 else
'''
# Create vector quantity
quantity <- 38
# Set the is-else statement
if ... |
###############
#LIBS
###############
library(lme4)
library(reshape)
library(foreign)
library(ggplot2)
library(plyr)
library(data.table)
library(reshape2)
library(Hmisc)
library(mgcv)
library(gdata)
library(car)
library(dplyr)
library(ggmap)
library(broom)
library(splines)
library(DataCombine)
#sourcing
source("/medi... | /Uni/Projects/code/P031.MAIAC.France/archive/pmper.region.r | no_license | zeltak/org | R | false | false | 2,712 | r |
###############
#LIBS
###############
library(lme4)
library(reshape)
library(foreign)
library(ggplot2)
library(plyr)
library(data.table)
library(reshape2)
library(Hmisc)
library(mgcv)
library(gdata)
library(car)
library(dplyr)
library(ggmap)
library(broom)
library(splines)
library(DataCombine)
#sourcing
source("/medi... |
#####################
# power analysis
#####################
# libraries
library(pwr)
library(pwr2) # includes ss.2way = Sample size calculation for balanced two-way ANOVA models
library(ggplot2)
##---- set working directory ----
rm(list=ls())
normalizePath(readClipboard(),winslash = "/")
setwd("D:/Eggert/Documents/... | /code-r/power_analysis.R | no_license | AnjaEggert/ExpDesign_MixedModels | R | false | false | 2,224 | r | #####################
# power analysis
#####################
# libraries
library(pwr)
library(pwr2) # includes ss.2way = Sample size calculation for balanced two-way ANOVA models
library(ggplot2)
##---- set working directory ----
rm(list=ls())
normalizePath(readClipboard(),winslash = "/")
setwd("D:/Eggert/Documents/... |
# Run example analysis using netcdf stored genotypes (as created in "create_ncdf.R")
# This example runs linear regression, but the modeling functions can be changed to any
# analysis. The capture values for the results would need to be changed appropriately.
library(ncdf)
# Simulate phenotype data
nsamples <- 500
pre... | /ncdf_analysis.R | no_license | nunonog/netcdfGWAS | R | false | false | 2,944 | r | # Run example analysis using netcdf stored genotypes (as created in "create_ncdf.R")
# This example runs linear regression, but the modeling functions can be changed to any
# analysis. The capture values for the results would need to be changed appropriately.
library(ncdf)
# Simulate phenotype data
nsamples <- 500
pre... |
#################################################
Regression diagonistics:
#################################################
states
fit <- lm(Murder ~ ., data=states)
confint(fit)
# confint indicates that you can be 95% confident that interval
# [2.38, 5.9] contains true change in murder rate for 1 percent change i... | /Regression_diagnosis.R | no_license | sunnysingh30/R-Learning-Projects | R | false | false | 3,079 | r | #################################################
Regression diagonistics:
#################################################
states
fit <- lm(Murder ~ ., data=states)
confint(fit)
# confint indicates that you can be 95% confident that interval
# [2.38, 5.9] contains true change in murder rate for 1 percent change i... |
#' Applies a fast-and-frugal tree to a dataset and generates several accuracy statistics
#'
#' @param formula A formula
#' @param data dataframe. A model training dataset. An m x n dataframe containing n cue values for each of the m exemplars.
#' @param tree.definitions dataframe. Definitions of one or more trees. The ... | /R/applytree_function.R | no_license | JasonAizkalns/FFTrees | R | false | false | 9,570 | r | #' Applies a fast-and-frugal tree to a dataset and generates several accuracy statistics
#'
#' @param formula A formula
#' @param data dataframe. A model training dataset. An m x n dataframe containing n cue values for each of the m exemplars.
#' @param tree.definitions dataframe. Definitions of one or more trees. The ... |
## plot2.R ###
## Exploratory Data Analysis Week One Homework ##
## David J. Risius ##
#Set the working directory
setwd("~/Data_Science_Specialization/4_ExploritoryDataAnalysis/data")
#read the file
power <- read.table(file = "household_power_consumption.txt", header = TRUE, sep = ";")
#Adds a new column with date a... | /plot4.R | no_license | risiud/ExData_Plotting1 | R | false | false | 2,514 | r | ## plot2.R ###
## Exploratory Data Analysis Week One Homework ##
## David J. Risius ##
#Set the working directory
setwd("~/Data_Science_Specialization/4_ExploritoryDataAnalysis/data")
#read the file
power <- read.table(file = "household_power_consumption.txt", header = TRUE, sep = ";")
#Adds a new column with date a... |
new_data_model <- function(tables, columns, references) {
stopifnot(nrow(tables) > 0)
stopifnot(nrow(columns) > 0)
structure(
list(
tables = tables,
columns = columns,
references = references
),
class = "data_model"
)
}
get_datamodel_from_overview <- function(overview) {
new_da... | /R/data-model-helpers.R | permissive | lorenzwalthert/dm | R | false | false | 1,213 | r | new_data_model <- function(tables, columns, references) {
stopifnot(nrow(tables) > 0)
stopifnot(nrow(columns) > 0)
structure(
list(
tables = tables,
columns = columns,
references = references
),
class = "data_model"
)
}
get_datamodel_from_overview <- function(overview) {
new_da... |
# SIF sentence model
# -----------------------------------------------------------------------------
# Load data
# -----------------------------------------------------------------------------
library(broom)
library(dplyr)
library(purrr)
library(glmnet)
library(magrittr)
library(randomForest)
library(tibble)
# Updat... | /scripts/fit-sif-sentence-embeddings.R | no_license | Intisar18/Thesis | R | false | false | 4,325 | r | # SIF sentence model
# -----------------------------------------------------------------------------
# Load data
# -----------------------------------------------------------------------------
library(broom)
library(dplyr)
library(purrr)
library(glmnet)
library(magrittr)
library(randomForest)
library(tibble)
# Updat... |
# Get CpdbVersion - Provides the version of ConsensusPathDB which is the source for functional sets.
#
#' Get CpdbVersion
#'
#' Provides the version of ConsensusPathDB which is the source for functional sets.
#'
#' @return string with ConsensusPathDB version
#'
#' @examples
#'
#' library(PathData)
#'
#' getCpdbVersion(... | /R/getCpdbVersion.R | permissive | isglobal-brge/brgeEnrich | R | false | false | 1,060 | r | # Get CpdbVersion - Provides the version of ConsensusPathDB which is the source for functional sets.
#
#' Get CpdbVersion
#'
#' Provides the version of ConsensusPathDB which is the source for functional sets.
#'
#' @return string with ConsensusPathDB version
#'
#' @examples
#'
#' library(PathData)
#'
#' getCpdbVersion(... |
#------------------------------------------------------------------
# Pulling covid19 data for Italy total, region, and province level
# Source: Presidenza del Consiglio dei Ministri - Dipartimento della Protezione Civile
# Website: http://www.protezionecivile.it/
# Github repo: https://github.com/pcm-dpc
#------------... | /data_raw/data_refresh.R | permissive | mkc030/covid19Italy | R | false | false | 9,297 | r | #------------------------------------------------------------------
# Pulling covid19 data for Italy total, region, and province level
# Source: Presidenza del Consiglio dei Ministri - Dipartimento della Protezione Civile
# Website: http://www.protezionecivile.it/
# Github repo: https://github.com/pcm-dpc
#------------... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scrape-utils.R
\name{scrape}
\alias{scrape}
\title{Scrape}
\usage{
scrape(
x,
encoding = "",
...,
options = c("RECOVER", "NOERROR", "NOBLANKS"),
sleep_time = 5,
verbose = TRUE
)
}
\arguments{
\item{x}{A string, a connection, or a ... | /man/scrape.Rd | no_license | meerapatelmd/skyscraper | R | false | true | 2,853 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scrape-utils.R
\name{scrape}
\alias{scrape}
\title{Scrape}
\usage{
scrape(
x,
encoding = "",
...,
options = c("RECOVER", "NOERROR", "NOBLANKS"),
sleep_time = 5,
verbose = TRUE
)
}
\arguments{
\item{x}{A string, a connection, or a ... |
## ---- eval = T-----------------------------------------------------------
library(medicare)
# load the package data
data(pos2010, package = "medicare")
names(pos2010)[1:10]
## ------------------------------------------------------------------------
# filepath should be changed by user
filepath <- system.file("extdat... | /inst/doc/provider_of_service_naming.R | no_license | cran/medicare | R | false | false | 1,149 | r | ## ---- eval = T-----------------------------------------------------------
library(medicare)
# load the package data
data(pos2010, package = "medicare")
names(pos2010)[1:10]
## ------------------------------------------------------------------------
# filepath should be changed by user
filepath <- system.file("extdat... |
######## FIGURE NET INTERACTION STRENGTH ########
#################################################
setwd("~/GitHub/Talk_seminar1UdeS/figuresAz")
#### Functions to compute net strength of trophic cascade ####
### log(Heff3), log(Peff2) & log(Peff3) ###
logPHeff=function(para) {
with(as.list(para),{
## Equil... | /figuresAz/NetIS.R | no_license | Azenor/talk_seminar1UdeS | R | false | false | 2,919 | r | ######## FIGURE NET INTERACTION STRENGTH ########
#################################################
setwd("~/GitHub/Talk_seminar1UdeS/figuresAz")
#### Functions to compute net strength of trophic cascade ####
### log(Heff3), log(Peff2) & log(Peff3) ###
logPHeff=function(para) {
with(as.list(para),{
## Equil... |
# S3 accessor methods
extractFUN <- function(x) {
UseMethod("extractFUN")
}
`extractFUN<-` <- function(x, value) {
UseMethod("extractFUN<-")
}
extractFUN.mmap <- function(x) {
x$extractFUN
}
`extractFUN<-.mmap` <- function(x, value) {
x$extractFUN <- value
x
}
replaceFUN <- function(x) {
UseMethod("replaceF... | /R/mmap.R | no_license | rkomartin/mmap | R | false | false | 9,803 | r | # S3 accessor methods
extractFUN <- function(x) {
UseMethod("extractFUN")
}
`extractFUN<-` <- function(x, value) {
UseMethod("extractFUN<-")
}
extractFUN.mmap <- function(x) {
x$extractFUN
}
`extractFUN<-.mmap` <- function(x, value) {
x$extractFUN <- value
x
}
replaceFUN <- function(x) {
UseMethod("replaceF... |
library(shiny)
# Define UI for application
shinyUI(pageWithSidebar(
# Application title
headerPanel("likert Demo"),
#
sidebarPanel(#TODO read in defaults rather than setting
selectInput("dataset", "Select an Item:",
choices=c('l24','l29')),
checkboxInput("include.center", "Inclu... | /inst/shiny/ui.R | no_license | houshuang/likert | R | false | false | 1,415 | r | library(shiny)
# Define UI for application
shinyUI(pageWithSidebar(
# Application title
headerPanel("likert Demo"),
#
sidebarPanel(#TODO read in defaults rather than setting
selectInput("dataset", "Select an Item:",
choices=c('l24','l29')),
checkboxInput("include.center", "Inclu... |
# R script to generate test .rda and .rds files
if ((as.integer(version$major) < 3) || (as.integer(substr(version$minor, 1, 1)) < 5)) {
stop("Script requires R>=3.5 to generate RData version 2 and 3")
}
sys_tz = Sys.getenv("TZ") # remember System TimeZone
for (ver in c(2, 3)) {
message("Generating RData/RDS files ... | /test/generate_rda.R | permissive | JuliaTagBot/RData.jl | R | false | false | 5,791 | r | # R script to generate test .rda and .rds files
if ((as.integer(version$major) < 3) || (as.integer(substr(version$minor, 1, 1)) < 5)) {
stop("Script requires R>=3.5 to generate RData version 2 and 3")
}
sys_tz = Sys.getenv("TZ") # remember System TimeZone
for (ver in c(2, 3)) {
message("Generating RData/RDS files ... |
#' Add/remove a primary key
#'
#' @description `dm_add_pk()` marks the specified columns as the primary key of the specified table.
#' If `check == TRUE`, then it will first check if
#' the given combination of columns is a unique key of the table.
#' If `force == TRUE`, the function will replace an already
#' set key.... | /R/primary-keys.R | permissive | jimsforks/dm | R | false | false | 11,468 | r | #' Add/remove a primary key
#'
#' @description `dm_add_pk()` marks the specified columns as the primary key of the specified table.
#' If `check == TRUE`, then it will first check if
#' the given combination of columns is a unique key of the table.
#' If `force == TRUE`, the function will replace an already
#' set key.... |
context("Rendering a graph object")
test_that("rendering a graph is indeed possible", {
# Create a node data frame
ndf <-
create_node_df(
n = 26,
type = "letter",
shape = sample(c("circle", "rectangle"),
length(1:26),
replace = TRUE),
fillcolor... | /tests/testthat/test-render_graph_series.R | permissive | OleksiyAnokhin/DiagrammeR | R | false | false | 2,991 | r | context("Rendering a graph object")
test_that("rendering a graph is indeed possible", {
# Create a node data frame
ndf <-
create_node_df(
n = 26,
type = "letter",
shape = sample(c("circle", "rectangle"),
length(1:26),
replace = TRUE),
fillcolor... |
\name{StatisticsPhD}
\alias{StatisticsPhD}
\docType{data}
\title{
Statistics PhD Programs
}
\description{
Enrollments in Statistics PhD Programs
}
\usage{data(StatisticsPhD)}
\format{
A data frame with 82 observations on the following 3 variables.
\describe{
\item{\code{University}}{Name of the school}
\ite... | /man/StatisticsPhD.Rd | no_license | statmanrobin/Lock5Data | R | false | false | 1,131 | rd | \name{StatisticsPhD}
\alias{StatisticsPhD}
\docType{data}
\title{
Statistics PhD Programs
}
\description{
Enrollments in Statistics PhD Programs
}
\usage{data(StatisticsPhD)}
\format{
A data frame with 82 observations on the following 3 variables.
\describe{
\item{\code{University}}{Name of the school}
\ite... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/statistical_tests.r
\name{hypergeometric}
\alias{hypergeometric}
\title{Hypergeometric test}
\usage{
hypergeometric(counts)
}
\arguments{
\item{counts}{A 2x2 numerical matrix representing a contingency table.}
}
\value{
a p-value of enrichmen... | /man/hypergeometric.Rd | no_license | reimandlab/ActivePathways | R | false | true | 729 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/statistical_tests.r
\name{hypergeometric}
\alias{hypergeometric}
\title{Hypergeometric test}
\usage{
hypergeometric(counts)
}
\arguments{
\item{counts}{A 2x2 numerical matrix representing a contingency table.}
}
\value{
a p-value of enrichmen... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/computeoptimizer_operations.R
\name{computeoptimizer_get_ec2_recommendation_projected_metrics}
\alias{computeoptimizer_get_ec2_recommendation_projected_metrics}
\title{Returns the projected utilization metrics of Amazon EC2 instance
recommend... | /paws/man/computeoptimizer_get_ec2_recommendation_projected_metrics.Rd | permissive | sanchezvivi/paws | R | false | true | 1,734 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/computeoptimizer_operations.R
\name{computeoptimizer_get_ec2_recommendation_projected_metrics}
\alias{computeoptimizer_get_ec2_recommendation_projected_metrics}
\title{Returns the projected utilization metrics of Amazon EC2 instance
recommend... |
\name{Domain.est}
\alias{Domain.est}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Stratified domain estimates
}
\description{
Calculates domain mean and variances for stratified design
}
\usage{
Domain.est(x, Strata, Domain, strata.obj, domain.obj, Species)
}
%- maybe also 'usage' for other ob... | /BIOSurvey2/BIOSurvey2/man/Domain.est.Rd | no_license | risdell/VA_Oyster_Survey | R | false | false | 3,130 | rd | \name{Domain.est}
\alias{Domain.est}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Stratified domain estimates
}
\description{
Calculates domain mean and variances for stratified design
}
\usage{
Domain.est(x, Strata, Domain, strata.obj, domain.obj, Species)
}
%- maybe also 'usage' for other ob... |
################################################################################
#' Determine primitivity of a matrix
#'
#' @description
#' Determine whether a matrix is primitive or imprimitive
#'
#' @param A a square, non-negative numeric matrix of any dimension.
#'
#' @details
#' \code{isPrimitive} works o... | /R/isPrimitive.R | no_license | cran/popdemo | R | false | false | 1,472 | r | ################################################################################
#' Determine primitivity of a matrix
#'
#' @description
#' Determine whether a matrix is primitive or imprimitive
#'
#' @param A a square, non-negative numeric matrix of any dimension.
#'
#' @details
#' \code{isPrimitive} works o... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{naics_codes}
\alias{naics_codes}
\title{NAICS industry codes}
\format{
A data frame with 21 rows and 3 variables:
\describe{
\item{industry}{NAICS code}
\item{label}{Industry name}
\item{ind_level}{Sector level: ei... | /man/naics_codes.Rd | permissive | CT-Data-Haven/cwi | R | false | true | 658 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{naics_codes}
\alias{naics_codes}
\title{NAICS industry codes}
\format{
A data frame with 21 rows and 3 variables:
\describe{
\item{industry}{NAICS code}
\item{label}{Industry name}
\item{ind_level}{Sector level: ei... |
library(testthat)
library(clubSandwich)
test_check("clubSandwich")
| /tests/testthat.R | no_license | cran/clubSandwich | R | false | false | 72 | r | library(testthat)
library(clubSandwich)
test_check("clubSandwich")
|
library(mousetrap)
### Name: mt_sample_entropy
### Title: Calculate sample entropy.
### Aliases: mt_sample_entropy
### ** Examples
# Calculate sample entropy based on time-normalized
# trajectories and merge results with other meausres
# derived from raw trajectories
mt_example <- mt_measures(mt_example)
mt_example... | /data/genthat_extracted_code/mousetrap/examples/mt_sample_entropy.Rd.R | no_license | surayaaramli/typeRrh | R | false | false | 513 | r | library(mousetrap)
### Name: mt_sample_entropy
### Title: Calculate sample entropy.
### Aliases: mt_sample_entropy
### ** Examples
# Calculate sample entropy based on time-normalized
# trajectories and merge results with other meausres
# derived from raw trajectories
mt_example <- mt_measures(mt_example)
mt_example... |
library(ape)
testtree <- read.tree("2152_2.txt")
unrooted_tr <- unroot(testtree)
write.tree(unrooted_tr, file="2152_2_unrooted.txt") | /codeml_files/newick_trees_processed/2152_2/rinput.R | no_license | DaniBoo/cyanobacteria_project | R | false | false | 135 | r | library(ape)
testtree <- read.tree("2152_2.txt")
unrooted_tr <- unroot(testtree)
write.tree(unrooted_tr, file="2152_2_unrooted.txt") |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{PNV}
\alias{PNV}
\title{\code{PNV} dataset}
\format{
A data frame (\code{RasterBrick} object) with 71698 rows and 172800 columns.
}
\source{
\insertRef{hengl2018global1kmres}{smpds}
}
\usage{
PNV
}
\description{
Gl... | /man/PNV.Rd | permissive | special-uor/smpds | R | false | true | 464 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{PNV}
\alias{PNV}
\title{\code{PNV} dataset}
\format{
A data frame (\code{RasterBrick} object) with 71698 rows and 172800 columns.
}
\source{
\insertRef{hengl2018global1kmres}{smpds}
}
\usage{
PNV
}
\description{
Gl... |
# You can learn more about package authoring with RStudio at:
#
# http://r-pkgs.had.co.nz/
#
# Some useful keyboard shortcuts for package authoring:
#
# Build and Reload Package: 'Ctrl + Shift + B'
# Check Package: 'Ctrl + Shift + E'
# Test Package: 'Ctrl + Shift + T'
# Yo... | /R/sorptionAnalysis.R | no_license | cran/SorptionAnalysis | R | false | false | 658 | r | # You can learn more about package authoring with RStudio at:
#
# http://r-pkgs.had.co.nz/
#
# Some useful keyboard shortcuts for package authoring:
#
# Build and Reload Package: 'Ctrl + Shift + B'
# Check Package: 'Ctrl + Shift + E'
# Test Package: 'Ctrl + Shift + T'
# Yo... |
y <- c("f", "e", "k")
| /test_file2.R | no_license | Helixir60/msba_intro | R | false | false | 22 | r | y <- c("f", "e", "k")
|
#' Calculate the rowwise sum for columns selected in data.frame
#'
#' @param .data data.frame
#' @param ... columns selected for rowwise `sum` or `mean` using `tidyselect` grammar
#' @param .name the name of new column
#' @param na.rm whether to delete the missing value, `TRUE` or `FALSE`
#'
#' @return
#' @export
#'
... | /R/rowwise.R | permissive | perlatex/easyuse | R | false | false | 4,968 | r | #' Calculate the rowwise sum for columns selected in data.frame
#'
#' @param .data data.frame
#' @param ... columns selected for rowwise `sum` or `mean` using `tidyselect` grammar
#' @param .name the name of new column
#' @param na.rm whether to delete the missing value, `TRUE` or `FALSE`
#'
#' @return
#' @export
#'
... |
# K-Means Clustering
# Importing the datset
dataset <- read.csv("Mall_Customers.csv")
x <- dataset[4: 5]
# Using the Elbow Method to find the optimal number of cluster
set.seed(6)
wcss <- vector()
for (i in 1:10) wcss[i] <- sum(kmeans(x, i)$withinss)
plot(1:10, wcss, type = 'b', main = paste('Clusters of clients'), x... | /k_means_clustering.R | no_license | adityajain1310/mall_customer--K-Means-Clustering | R | false | false | 794 | r | # K-Means Clustering
# Importing the datset
dataset <- read.csv("Mall_Customers.csv")
x <- dataset[4: 5]
# Using the Elbow Method to find the optimal number of cluster
set.seed(6)
wcss <- vector()
for (i in 1:10) wcss[i] <- sum(kmeans(x, i)$withinss)
plot(1:10, wcss, type = 'b', main = paste('Clusters of clients'), x... |
epane <- function(X){
XX <- X^2
ep <- (3/4)*(1-XX)*(XX<=1)
return(ep)
}
gaussien <- function(X){
XX <- X^2
ga <- 1/sqrt(2*pi)*exp(-0.5*XX)
return(ga)
}
quartic <- function(X){
XX <- X^2
qu <- (15/16)*((1-XX)^2)*(XX<=1)
return(qu)
}
uniform <- function(X){
XX<-X^2
un<-1*(XX<=1)
return(un)
}
| /R/kernel.R | no_license | cran/ibr | R | false | false | 291 | r | epane <- function(X){
XX <- X^2
ep <- (3/4)*(1-XX)*(XX<=1)
return(ep)
}
gaussien <- function(X){
XX <- X^2
ga <- 1/sqrt(2*pi)*exp(-0.5*XX)
return(ga)
}
quartic <- function(X){
XX <- X^2
qu <- (15/16)*((1-XX)^2)*(XX<=1)
return(qu)
}
uniform <- function(X){
XX<-X^2
un<-1*(XX<=1)
return(un)
}
|
sales <- data.frame(labels = c("Prev yr","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec","prent yr"),
value = c(45,2,-18,-25,6,7.6,9.8,-6.8,-10,7.7,8.5,-16,5,15.8),
logic = c(TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE)
)
library(ggplot2)
sales$labels <- fa... | /topgear_waterfall.R | no_license | abhilash-tango/top_rchart | R | false | false | 792 | r | sales <- data.frame(labels = c("Prev yr","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec","prent yr"),
value = c(45,2,-18,-25,6,7.6,9.8,-6.8,-10,7.7,8.5,-16,5,15.8),
logic = c(TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE)
)
library(ggplot2)
sales$labels <- fa... |
# hcr_nafo is a function that produces a HCR that can have one or two stages. It has a Blim1 value (the one corresponding to precautionary approach Blim concept), below which F is zero. When SSB is between Blim1 and Btrigger1, F will be between 0 and Ftarget1; when SSB is bewteeen Btrigger1 and Blim2 (not related with ... | /codes/overrides.R | no_license | ldbk/flr-gadget | R | false | false | 5,845 | r | # hcr_nafo is a function that produces a HCR that can have one or two stages. It has a Blim1 value (the one corresponding to precautionary approach Blim concept), below which F is zero. When SSB is between Blim1 and Btrigger1, F will be between 0 and Ftarget1; when SSB is bewteeen Btrigger1 and Blim2 (not related with ... |
install.packages("blavaan", repos="http://faculty.missouri.edu/~merklee", type="source")
library(blavaan)
data("Demo.growth")
colnames(Demo.growth)[1:4] = c("X1","X2","X3","X4")
#LCS specification (constant change)
constantX.syntax <-'
#X
#latent variables
lX1 =~ 1*X1; lX2 =~ 1*X2; lX3 =~ 1*X3; lX4 =~ 1*X4;
#autor... | /LDS_example.R | no_license | Rjacobucci/random_code | R | false | false | 1,246 | r | install.packages("blavaan", repos="http://faculty.missouri.edu/~merklee", type="source")
library(blavaan)
data("Demo.growth")
colnames(Demo.growth)[1:4] = c("X1","X2","X3","X4")
#LCS specification (constant change)
constantX.syntax <-'
#X
#latent variables
lX1 =~ 1*X1; lX2 =~ 1*X2; lX3 =~ 1*X3; lX4 =~ 1*X4;
#autor... |
### =========================================================================
### Soumillon
### =========================================================================
library(Seurat)
library(R.utils)
download.file("https://ftp.ncbi.nlm.nih.gov/geo/series/GSE53nnn/GSE53638/suppl/GSE53638_D3_UMI.dat.gz",
"GSE53638_... | /inst/scripts/make-Soumillon-data.R | no_license | SydneyBioX/SimBenchData | R | false | false | 1,240 | r |
### =========================================================================
### Soumillon
### =========================================================================
library(Seurat)
library(R.utils)
download.file("https://ftp.ncbi.nlm.nih.gov/geo/series/GSE53nnn/GSE53638/suppl/GSE53638_D3_UMI.dat.gz",
"GSE53638_... |
########################################################################################################################
########### FBarraquand 18/05/2017 - GC analysis with proper model selection on nonlinear community dynamics ###########
##############################################################################... | /2species/StochasticCompet.R | no_license | Khalil628/GCausality | R | false | false | 22,603 | r | ########################################################################################################################
########### FBarraquand 18/05/2017 - GC analysis with proper model selection on nonlinear community dynamics ###########
##############################################################################... |
#' ## Multiple hypothesis testing and correcting for the resulting errors. ##
#' ### An R-code-based walkthrough of concepts and intuition. ###
#' ##### Load libraries #####
library(ggplot2)
library(doMC)
#' ##### Functions #####
visualize_distribution <- function(datasub, name_of_column_to_plot, fillwhat = "blue"){
... | /R/multiple_hypotheses_testing_corrections.R | no_license | skolitz/statistical_scribbles | R | false | false | 23,878 | r | #' ## Multiple hypothesis testing and correcting for the resulting errors. ##
#' ### An R-code-based walkthrough of concepts and intuition. ###
#' ##### Load libraries #####
library(ggplot2)
library(doMC)
#' ##### Functions #####
visualize_distribution <- function(datasub, name_of_column_to_plot, fillwhat = "blue"){
... |
library(testthat)
library(cvtmleAUC)
test_check("cvtmleAUC")
| /tests/testthat.R | permissive | benkeser/cvtmleAUC | R | false | false | 62 | r | library(testthat)
library(cvtmleAUC)
test_check("cvtmleAUC")
|
# Item Scale...
test <- DataFactor2IntClass(correctData)
modelT <- ' fact_1 =~ SITopicPolitics1 + SITopicLocalEvents1 + SITopicFriends1 + SITopicLeisure1 + SITopicFamily1 '
fit <- cfa(modelT, test[,SITopic1])
summary(fit)
correctData$Topic <- predict(fit)
correctData$Topic <- test$SITopicPolitics1 + 1.5... | /item_Selection.R | permissive | m-santh/SEM-using-R | R | false | false | 16,890 | r | # Item Scale...
test <- DataFactor2IntClass(correctData)
modelT <- ' fact_1 =~ SITopicPolitics1 + SITopicLocalEvents1 + SITopicFriends1 + SITopicLeisure1 + SITopicFamily1 '
fit <- cfa(modelT, test[,SITopic1])
summary(fit)
correctData$Topic <- predict(fit)
correctData$Topic <- test$SITopicPolitics1 + 1.5... |
#' Get all site indices for a label
#'
#' Gets indicies of all sites with a given label
#' @param obj a rateModel object
#' @param label a site label
#' @name getLabelIndices
#' @return a numeric vector of indices
#' @include rateModel-class.R
#' @examples
#'
#' @export
methods::setGeneric("getLabelIndices", function... | /R/getLabelIndices.R | no_license | ndukler/epiAlleleGLM | R | false | false | 666 | r | #' Get all site indices for a label
#'
#' Gets indicies of all sites with a given label
#' @param obj a rateModel object
#' @param label a site label
#' @name getLabelIndices
#' @return a numeric vector of indices
#' @include rateModel-class.R
#' @examples
#'
#' @export
methods::setGeneric("getLabelIndices", function... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/F.norm2.R
\name{F.norm2}
\alias{F.norm2}
\title{The Squared Frobenius Norm}
\usage{
F.norm2(matrix)
}
\arguments{
\item{matrix}{a matrix}
}
\value{
a scalar of the squared Frobenius norm
}
\description{
Calculate the squared Fr... | /man/F.norm2.Rd | no_license | cran/FinCovRegularization | R | false | true | 446 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/F.norm2.R
\name{F.norm2}
\alias{F.norm2}
\title{The Squared Frobenius Norm}
\usage{
F.norm2(matrix)
}
\arguments{
\item{matrix}{a matrix}
}
\value{
a scalar of the squared Frobenius norm
}
\description{
Calculate the squared Fr... |
#install packages needed and input them to the lib for R to reference
#NOTE: aplore3 is a package that has all datasets used from the Hosmer book
install.packages("aplore3")
library(aplore3)
#print out the first 20 obs to make sure our data looks correct
head(glow500, n=5)
#bringing our variables in to environment
ra... | /Homework1_Glow500.R | no_license | sohcahtoaster/glow500 | R | false | false | 1,324 | r | #install packages needed and input them to the lib for R to reference
#NOTE: aplore3 is a package that has all datasets used from the Hosmer book
install.packages("aplore3")
library(aplore3)
#print out the first 20 obs to make sure our data looks correct
head(glow500, n=5)
#bringing our variables in to environment
ra... |
context("Test that fastpca works.")
test_that("PCA works", {
x <- matrix(data=rnorm(100), ncol=10, nrow=10)
expect_silent(fastpca(x, k=4))
expect_warning(fastpca(x, k=10),
"all singular values are requested")
expect_error(fastpca(x, k=30))
})
context("Test that fastpca is equivalent... | /tests/testthat/test_pca.R | no_license | siyao-liu/fastpca | R | false | false | 533 | r | context("Test that fastpca works.")
test_that("PCA works", {
x <- matrix(data=rnorm(100), ncol=10, nrow=10)
expect_silent(fastpca(x, k=4))
expect_warning(fastpca(x, k=10),
"all singular values are requested")
expect_error(fastpca(x, k=30))
})
context("Test that fastpca is equivalent... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/matrix_eval.R
\name{eval_transition}
\alias{eval_transition}
\title{Evaluate Markov Model Transition Matrix}
\usage{
eval_transition(x, parameters)
}
\arguments{
\item{x}{an \code{uneval_matrix} object.}
\item{parameters}{an \code{eval_param... | /man/eval_transition.Rd | no_license | cran/heemod | R | false | true | 686 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/matrix_eval.R
\name{eval_transition}
\alias{eval_transition}
\title{Evaluate Markov Model Transition Matrix}
\usage{
eval_transition(x, parameters)
}
\arguments{
\item{x}{an \code{uneval_matrix} object.}
\item{parameters}{an \code{eval_param... |
% Generated by roxygen2 (4.0.2): do not edit by hand
\name{write_wtr}
\alias{write_wtr}
\title{write Lake Analyzer *.wtr file from GLM simulation}
\usage{
write_wtr(glm_temp, lake_name = "lake", folder_out)
}
\arguments{
\item{glm_temp}{a data.frame with DateTime and temperatures from GLM}
\item{lake_name}{a string fo... | /man/write_wtr.Rd | no_license | ldecicco-USGS/glmtools | R | false | false | 914 | rd | % Generated by roxygen2 (4.0.2): do not edit by hand
\name{write_wtr}
\alias{write_wtr}
\title{write Lake Analyzer *.wtr file from GLM simulation}
\usage{
write_wtr(glm_temp, lake_name = "lake", folder_out)
}
\arguments{
\item{glm_temp}{a data.frame with DateTime and temperatures from GLM}
\item{lake_name}{a string fo... |
# First: 15-jan-2020
# Update: 28-jan-2020
# Author: NNB
# Purpose: Prepare data for regression model
# =============================================================================
# Instruction
# R/0_main.R : File chính chạy các kết quả
# R/1_functions.R: Chứa các user-defined functions
# R/2_plots.R: Chứa các hàm t... | /R_backup/0_main_bins_woe.R | no_license | nguyenngocbinh/kalapa | R | false | false | 10,440 | r | # First: 15-jan-2020
# Update: 28-jan-2020
# Author: NNB
# Purpose: Prepare data for regression model
# =============================================================================
# Instruction
# R/0_main.R : File chính chạy các kết quả
# R/1_functions.R: Chứa các user-defined functions
# R/2_plots.R: Chứa các hàm t... |
## To Cache the Inverse of a Matrix:-
## Matrix inversion is usually a costly computation and there may be some
## benefit to caching the inverse of a matrix rather than compute it repeatedly.
## Below are a pair of functions that are used to create a special object that
## stores a matrix and caches its inverse.... | /cachematrix.R | no_license | kavitapabreja/ProgrammingAssignment2 | R | false | false | 1,587 | r | ## To Cache the Inverse of a Matrix:-
## Matrix inversion is usually a costly computation and there may be some
## benefit to caching the inverse of a matrix rather than compute it repeatedly.
## Below are a pair of functions that are used to create a special object that
## stores a matrix and caches its inverse.... |
## This library serves as an API to an Object Oriented style
## cached matrix. See individual function comments for usage
## instructions.
# This function wraps a matrix while caching the inverse
# It returns a list of functions to create Object Oriented style
# functionality holding the matrix and its inverse as sta... | /cachematrix.R | no_license | kevinmorris/ProgrammingAssignment2 | R | false | false | 976 | r | ## This library serves as an API to an Object Oriented style
## cached matrix. See individual function comments for usage
## instructions.
# This function wraps a matrix while caching the inverse
# It returns a list of functions to create Object Oriented style
# functionality holding the matrix and its inverse as sta... |
# defining murder rate as before
murder_rate <- murders$total / murders$population * 100000
# creating a logical vector that specifies if the murder rate in that state is less than or equal to 0.71
index <- murder_rate <= 0.71
# determining which states have murder rates less than or equal to 0.71
murders$state[in... | /Introduction to R/safer-state.R | no_license | yatz77/R-Data-Science-Course-Material | R | false | false | 1,102 | r | # defining murder rate as before
murder_rate <- murders$total / murders$population * 100000
# creating a logical vector that specifies if the murder rate in that state is less than or equal to 0.71
index <- murder_rate <= 0.71
# determining which states have murder rates less than or equal to 0.71
murders$state[in... |
library(shiny)
library(MASS)
library(ggplot2)
shinyServer(function(input, output) {
misDatos<- reactiveValues(muestra=NULL, x=NULL, y= NULL) # En esta lista tipo reactive creamos tres variables que las dejamos en blanco. "muestra" "x" "y".
#Para modificar el reactivevalues tenemos que utilizar... | /Visualizacion/Shiny/muestras aleatorias/server.R | no_license | ManuelCarmonaDS/Master-in-Data-Science---CUNEF | R | false | false | 2,252 | r | library(shiny)
library(MASS)
library(ggplot2)
shinyServer(function(input, output) {
misDatos<- reactiveValues(muestra=NULL, x=NULL, y= NULL) # En esta lista tipo reactive creamos tres variables que las dejamos en blanco. "muestra" "x" "y".
#Para modificar el reactivevalues tenemos que utilizar... |
#' Coerces string of RevBayes output into an equivalent R object.
#'
#' Coerces string of RevBayes output into an equivalent R object.
#' Uses the structure of the characters within the string to identify an appropiate R object type (a list, vector,
#' or even phylo tree) to coerce the string into.
#'
#' @param ... out... | /R/CoerceRev.R | no_license | tpellard/Revticulate | R | false | false | 4,746 | r | #' Coerces string of RevBayes output into an equivalent R object.
#'
#' Coerces string of RevBayes output into an equivalent R object.
#' Uses the structure of the characters within the string to identify an appropiate R object type (a list, vector,
#' or even phylo tree) to coerce the string into.
#'
#' @param ... out... |
install.packages("caret")
install.packages("classifierplots")
install.packages("ggplot2")
install.packages("ggraph")
install.packages("ggthemes")
install.packages("igraph")
install.packages("quanteda")
install.packages("qdap")
install.packages("tidytext")
install.packages("tidyverse")
install.packages("SnowballC")
inst... | /Chapter13/13nlp_clean.R | permissive | PacktPublishing/Mastering-Machine-Learning-with-R-Third-Edition | R | false | false | 9,200 | r | install.packages("caret")
install.packages("classifierplots")
install.packages("ggplot2")
install.packages("ggraph")
install.packages("ggthemes")
install.packages("igraph")
install.packages("quanteda")
install.packages("qdap")
install.packages("tidytext")
install.packages("tidyverse")
install.packages("SnowballC")
inst... |
library(magrittr)
library(plotly)
library(quantmod)
library(dplyr)
library(DescTools)
library(devtools)
install_github("daroczig/binancer")
library(binancer)
key <- 'API Key'
secret <- 'Secret Key'
binance_ping()
binance_credentials(key, secret)
data <- binance_klines('BTCUSDT', interval = '5m')
precioBTC <- binanc... | /Candlestick.R | no_license | rflsierra/Criptotrading_test | R | false | false | 1,117 | r | library(magrittr)
library(plotly)
library(quantmod)
library(dplyr)
library(DescTools)
library(devtools)
install_github("daroczig/binancer")
library(binancer)
key <- 'API Key'
secret <- 'Secret Key'
binance_ping()
binance_credentials(key, secret)
data <- binance_klines('BTCUSDT', interval = '5m')
precioBTC <- binanc... |
binomial.CARsepspatial <- function(formula, data=NULL, trials, W, burnin, n.sample, thin=1, prior.mean.beta=NULL, prior.var.beta=NULL, prior.tau2=NULL, rho.S=NULL, rho.T=NULL, MALA=TRUE, verbose=TRUE)
{
##############################################
#### Format the arguments and check for errors
################... | /R/binomial.CARsepspatial.R | no_license | cran/CARBayesST | R | false | false | 19,108 | r | binomial.CARsepspatial <- function(formula, data=NULL, trials, W, burnin, n.sample, thin=1, prior.mean.beta=NULL, prior.var.beta=NULL, prior.tau2=NULL, rho.S=NULL, rho.T=NULL, MALA=TRUE, verbose=TRUE)
{
##############################################
#### Format the arguments and check for errors
################... |
# 1 Merges the training and the test sets to create one data set
tmp1 <- read.table("train/X_train.txt")
tmp2 <- read.table("test/X_test.txt")
X <- rbind(tmp1, tmp2)
tmp1 <- read.table("train/subject_train.txt")
tmp2 <- read.table("test/subject_test.txt")
S <- rbind(tmp1, tmp2)
tmp1 <- read.table("train/y_train.tx... | /run_analysis.R | no_license | aini2403/Getting_and_Cleaning_Data_Project | R | false | false | 1,803 | r | # 1 Merges the training and the test sets to create one data set
tmp1 <- read.table("train/X_train.txt")
tmp2 <- read.table("test/X_test.txt")
X <- rbind(tmp1, tmp2)
tmp1 <- read.table("train/subject_train.txt")
tmp2 <- read.table("test/subject_test.txt")
S <- rbind(tmp1, tmp2)
tmp1 <- read.table("train/y_train.tx... |
dataseturl <- "https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip"
download.file(dataseturl, "power.zip")
unzip("power.zip", exdir = "power")
list.files("power", full.names = TRUE)
data <- read.table("power/household_power_consumption.txt", sep=";",header=TRUE)
head(data)
for(... | /plot1.r | no_license | novajess/ExData_Plotting1 | R | false | false | 773 | r | dataseturl <- "https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip"
download.file(dataseturl, "power.zip")
unzip("power.zip", exdir = "power")
list.files("power", full.names = TRUE)
data <- read.table("power/household_power_consumption.txt", sep=";",header=TRUE)
head(data)
for(... |
library(forecast)
library(stats)
library(TSA)
library(FBN)
library(robustbase)
library("ggplot2")
library("tseries")
setwd("C:/Users/sametyazak/Desktop/ynwa/bau/2017 - Thesis/code/r/")
completeData = read.csv(file="..\\..\\data\\workspace\\real_full_standard_periodic.csv", header=TRUE, sep=",")
completeData = complete... | /code/r/arima_test_parameters.R | no_license | yazaksamet/masterthesis | R | false | false | 853 | r | library(forecast)
library(stats)
library(TSA)
library(FBN)
library(robustbase)
library("ggplot2")
library("tseries")
setwd("C:/Users/sametyazak/Desktop/ynwa/bau/2017 - Thesis/code/r/")
completeData = read.csv(file="..\\..\\data\\workspace\\real_full_standard_periodic.csv", header=TRUE, sep=",")
completeData = complete... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversions.R
\name{numTrades}
\alias{numTrades}
\title{Calculate number of trades in this position vector}
\usage{
numTrades(p)
}
\arguments{
\item{p}{the position vector indicating whether you are in position or out}
}
\value{
the number of... | /datrader/man/numTrades.Rd | no_license | DoktorMike/datrader | R | false | true | 542 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversions.R
\name{numTrades}
\alias{numTrades}
\title{Calculate number of trades in this position vector}
\usage{
numTrades(p)
}
\arguments{
\item{p}{the position vector indicating whether you are in position or out}
}
\value{
the number of... |
# SQL Using R
# PART 1
# 8 19 2016
# Install "sqldf" package
install.packages("sqldf")
library("sqldf")
# Load data
setwd("Z:/path")
dir()
data <- read.csv("SQL Latest Version Data 7 1 2016.csv")
# Select two columns of interest
count_table <- sqldf("select Name, Classification from data")
# Select two columns, bu... | /SQL_using_R.r | no_license | arckymx/SQL | R | false | false | 1,875 | r | # SQL Using R
# PART 1
# 8 19 2016
# Install "sqldf" package
install.packages("sqldf")
library("sqldf")
# Load data
setwd("Z:/path")
dir()
data <- read.csv("SQL Latest Version Data 7 1 2016.csv")
# Select two columns of interest
count_table <- sqldf("select Name, Classification from data")
# Select two columns, bu... |
library(caTools)
library(caret)
library(rpart)
library(rpart.plot)
base = read.csv('census.csv')
base$X = NULL
summary(base)
# Transformacao de variaveis categoricas
table(base$sex)
unique(base$sex)
base$sex = factor(base$sex, levels = c(' Female', ' Male'), labels = c(0, 1))
base[is.na(base$sex)]
base$workclass = f... | /Classificacao/Arvore_decisao/arvore_decisao_census.R | no_license | joscelino/Machine_Learning_em_R | R | false | false | 3,276 | r | library(caTools)
library(caret)
library(rpart)
library(rpart.plot)
base = read.csv('census.csv')
base$X = NULL
summary(base)
# Transformacao de variaveis categoricas
table(base$sex)
unique(base$sex)
base$sex = factor(base$sex, levels = c(' Female', ' Male'), labels = c(0, 1))
base[is.na(base$sex)]
base$workclass = f... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bayesglm.R
\name{invlogit}
\alias{invlogit}
\title{Inverse of logistic transformation}
\usage{
invlogit(x)
}
\arguments{
\item{x}{numeric}
}
\value{
inverse
}
\description{
Inverse of logistic transformation
}
| /man/invlogit.Rd | no_license | QinLab/MAST | R | false | true | 289 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bayesglm.R
\name{invlogit}
\alias{invlogit}
\title{Inverse of logistic transformation}
\usage{
invlogit(x)
}
\arguments{
\item{x}{numeric}
}
\value{
inverse
}
\description{
Inverse of logistic transformation
}
|
learn <- function(x, weight, inputName = NULL, iterations = 100) {
## Subset weight vectors
w10 <- weight[1]
w11 <- weight[2]
w12 <- weight[3]
# Subset input vectors
x1 <- x[, 1]
x2 <- x[, 2]
x3 <- x[, 3]
... | /Perceptron/Perceptron.R | permissive | jsebastiansalazar7/artificial-neural-networks | R | false | false | 7,440 | r | learn <- function(x, weight, inputName = NULL, iterations = 100) {
## Subset weight vectors
w10 <- weight[1]
w11 <- weight[2]
w12 <- weight[3]
# Subset input vectors
x1 <- x[, 1]
x2 <- x[, 2]
x3 <- x[, 3]
... |
######################################################################
### Tutorial Programação Funcional em R para Cientistas Sociais ###
######################################################################
setwd("~/Dropbox/repositories/tutorial_r_funcional")
#criando um banco com dados aleatórios
set.seed(1... | /tutorial_r_funcional.R | permissive | LuizNovi/automatizar | R | false | false | 12,051 | r | ######################################################################
### Tutorial Programação Funcional em R para Cientistas Sociais ###
######################################################################
setwd("~/Dropbox/repositories/tutorial_r_funcional")
#criando um banco com dados aleatórios
set.seed(1... |
cloneProto=function(l){
parent.layer<-proto_features(l)%>%
dplyr::left_join(ggedit::ggedit.opts$geom_opts%>%dplyr::filter_(~!grepl('^stat',fn)),
by = c("position", "geom", "stat"))
if(is.na(parent.layer$fn)) parent.layer$fn=paste0(tolower(strsplit(parent.layer$stat,'(?<=Stat)',perl =... | /R/cloneProto.R | no_license | jcheng5/ggedit | R | false | false | 1,990 | r | cloneProto=function(l){
parent.layer<-proto_features(l)%>%
dplyr::left_join(ggedit::ggedit.opts$geom_opts%>%dplyr::filter_(~!grepl('^stat',fn)),
by = c("position", "geom", "stat"))
if(is.na(parent.layer$fn)) parent.layer$fn=paste0(tolower(strsplit(parent.layer$stat,'(?<=Stat)',perl =... |
#(1.3) Function bin_choose
#' @title bin_choose()
#' @description bin_chooose() is a function that calculates the number of combinations in which k success canccur in n trials
#' @param n trials the number of the total trials
#' @param k scuuess the probability of a succeess
#' @return bin_chooose returns the numbe... | /workout03/binomial/R/bin_choose.R | no_license | stat133-sp19/hw-stat133-yipszeka | R | false | false | 623 | r | #(1.3) Function bin_choose
#' @title bin_choose()
#' @description bin_chooose() is a function that calculates the number of combinations in which k success canccur in n trials
#' @param n trials the number of the total trials
#' @param k scuuess the probability of a succeess
#' @return bin_chooose returns the numbe... |
# run_analysis.R
#
# 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. Appropriately labels the data set with descriptive variabl... | /run_analysis.R | no_license | kharakawa/getdata-course-project | R | false | false | 5,491 | r | # run_analysis.R
#
# 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. Appropriately labels the data set with descriptive variabl... |
\name{barah-package}
\alias{barah-package}
\alias{barah}
\docType{package}
\title{
Format elements into a specified pattern
}
\description{
Data comes in messy, unpredictable formats. Use the fashion function to bring
order to the chaos.
}
\details{
This section should provide a more detailed overview of how t... | /man/barah-package.Rd | permissive | daranzolin/barah | R | false | false | 480 | rd | \name{barah-package}
\alias{barah-package}
\alias{barah}
\docType{package}
\title{
Format elements into a specified pattern
}
\description{
Data comes in messy, unpredictable formats. Use the fashion function to bring
order to the chaos.
}
\details{
This section should provide a more detailed overview of how t... |
# Load, subset and transform data
power<-read.table("household_power_consumption.txt",na.strings="?",sep=";",header=TRUE,colClasses=c("character","character",rep("numeric",7)))
power1<-subset(power,Date=="1/2/2007" | Date=="2/2/2007")
power2<-data.frame(datetime=strptime(paste(power1$Date,power1$Time),"%d/%m/%Y %H:%M:... | /plot2.r | no_license | phustak/ExData_Plotting1 | R | false | false | 641 | r |
# Load, subset and transform data
power<-read.table("household_power_consumption.txt",na.strings="?",sep=";",header=TRUE,colClasses=c("character","character",rep("numeric",7)))
power1<-subset(power,Date=="1/2/2007" | Date=="2/2/2007")
power2<-data.frame(datetime=strptime(paste(power1$Date,power1$Time),"%d/%m/%Y %H:%M:... |
############################################################
# This script takes in a set of lat-lons (representing the subgrid we sample GLOBALLY)
# and assigns a population density value by taking the average of the
# Gridded Population of the World (GPW) dataset over each grid cell
#############################... | /code/analysis/2_label_creation/population/extractPopulation_global.R | permissive | hulaba/mosaiks-paper | R | false | false | 2,019 | r |
############################################################
# This script takes in a set of lat-lons (representing the subgrid we sample GLOBALLY)
# and assigns a population density value by taking the average of the
# Gridded Population of the World (GPW) dataset over each grid cell
#############################... |
rankhospital <- function(state, outcome, num = "best") {
## Read outcome data
## Read outcome data
outcome_data <- read.csv("rprog-data-ProgAssignment3-data/outcome-of-care-measures.csv")
outcome_prefix <- "Hospital.30.Day.Death..Mortality..Rates.from."
## Check that state and outcome are valid
outcome_w... | /rankhospital.R | no_license | StevenRoot/R_Class_Homework | R | false | false | 2,064 | r | rankhospital <- function(state, outcome, num = "best") {
## Read outcome data
## Read outcome data
outcome_data <- read.csv("rprog-data-ProgAssignment3-data/outcome-of-care-measures.csv")
outcome_prefix <- "Hospital.30.Day.Death..Mortality..Rates.from."
## Check that state and outcome are valid
outcome_w... |
r=359.71
https://sandbox.dams.library.ucdavis.edu/fcrepo/rest/collection/sherry-lehmann/catalogs/d74k53/media/images/d74k53-013/svc:tesseract/full/full/359.71/default.jpg Accept:application/hocr+xml
| /ark_87287/d74k53/d74k53-013/rotated.r | permissive | ucd-library/wine-price-extraction | R | false | false | 199 | r | r=359.71
https://sandbox.dams.library.ucdavis.edu/fcrepo/rest/collection/sherry-lehmann/catalogs/d74k53/media/images/d74k53-013/svc:tesseract/full/full/359.71/default.jpg Accept:application/hocr+xml
|
#Sunlight Foundation
#API Link: politicalpartytime.org/api/
#Documentation: http://sunlightlabs.github.io/partytime-docs/
library(RJSONIO)
library(plyr)
library(RCurl)
library(rjson)
#set directory
setwd(".../opensecrets-API") #change to your working directory
# Initialize a data frame
hdwd <- data.frame()
#seque... | /sunlightapi.R | permissive | aleszu/opensecrets-API | R | false | false | 1,142 | r | #Sunlight Foundation
#API Link: politicalpartytime.org/api/
#Documentation: http://sunlightlabs.github.io/partytime-docs/
library(RJSONIO)
library(plyr)
library(RCurl)
library(rjson)
#set directory
setwd(".../opensecrets-API") #change to your working directory
# Initialize a data frame
hdwd <- data.frame()
#seque... |
#' Fit smith max-stable model to bootstrap samples
#'
#' We have classified a gridded region based on a clustering outpput. The classification
#' step was necessary to identify region boundaries. This function fits a max-stable model
#' to obtain the dependence structure for the region. We sample from suitable stations... | /old/fit_smith_model1.R | no_license | katerobsau/clusterExtremes | R | false | false | 5,788 | r | #' Fit smith max-stable model to bootstrap samples
#'
#' We have classified a gridded region based on a clustering outpput. The classification
#' step was necessary to identify region boundaries. This function fits a max-stable model
#' to obtain the dependence structure for the region. We sample from suitable stations... |
library(glmnet)
mydata = read.table("./TrainingSet/AvgRank/pancreas.csv",head=T,sep=",")
x = as.matrix(mydata[,4:ncol(mydata)])
y = as.matrix(mydata[,1])
set.seed(123)
glm = cv.glmnet(x,y,nfolds=10,type.measure="mse",alpha=0.4,family="gaussian",standardize=TRUE)
sink('./Model/EN/AvgRank/pancreas/pancreas_049.txt',appen... | /Model/EN/AvgRank/pancreas/pancreas_049.R | no_license | leon1003/QSMART | R | false | false | 357 | r | library(glmnet)
mydata = read.table("./TrainingSet/AvgRank/pancreas.csv",head=T,sep=",")
x = as.matrix(mydata[,4:ncol(mydata)])
y = as.matrix(mydata[,1])
set.seed(123)
glm = cv.glmnet(x,y,nfolds=10,type.measure="mse",alpha=0.4,family="gaussian",standardize=TRUE)
sink('./Model/EN/AvgRank/pancreas/pancreas_049.txt',appen... |
library(ggplot2)
library(dplyr)
library(datacomb)
#df <- read.csv('../landsend_veg_2007_2012.csv', stringsAsFactors = FALSE, na.strings = c('-',''))
df <- read.csv('../cleaned_landsend_veg_2007_2012.csv', stringsAsFactors = FALSE, na.strings = c('-',''))
names(df) <- tolower(names(df))
#df <- df[!is.na(df$native_sta... | /park.R | no_license | odscwest/parksconserverancy | R | false | false | 2,853 | r | library(ggplot2)
library(dplyr)
library(datacomb)
#df <- read.csv('../landsend_veg_2007_2012.csv', stringsAsFactors = FALSE, na.strings = c('-',''))
df <- read.csv('../cleaned_landsend_veg_2007_2012.csv', stringsAsFactors = FALSE, na.strings = c('-',''))
names(df) <- tolower(names(df))
#df <- df[!is.na(df$native_sta... |
s = 'aba'
n = 10
letterCount <- function(s, n){
fullString <- paste(rep(s, ceiling(10 / nchar(s))),collapse = "")
fullString <- strsplit(fullString,'')[[1]]
fullString <- fullString[1:n]
ans <- length(grep(TRUE,sapply(fullString,function(X){X == 'a'})))
return(ans)
} | /prep/Rcode/letterCount.R | no_license | ewalsh/hackerRank | R | false | false | 278 | r | s = 'aba'
n = 10
letterCount <- function(s, n){
fullString <- paste(rep(s, ceiling(10 / nchar(s))),collapse = "")
fullString <- strsplit(fullString,'')[[1]]
fullString <- fullString[1:n]
ans <- length(grep(TRUE,sapply(fullString,function(X){X == 'a'})))
return(ans)
} |
logdet_chol = function(L) 2*sum(log(diag(L)))
loglik_marginal_NIW <- function(N, D, kappa, nu, S_chol, kappa0, nu0, S0_chol){
-0.5*N*D*log(pi) - 0.5*D*(log(kappa) - log(kappa0)) - 0.5*(nu*logdet_chol(S_chol) - nu0*logdet_chol(S0_chol)) + sum(lgamma(0.5*(nu - 1:D + 1)) - lgamma(0.5*(nu0 - 1:D + 1)))
}
add_sample_and... | /utils/helpers.R | no_license | bachvietdo01/stats700-final | R | false | false | 2,416 | r | logdet_chol = function(L) 2*sum(log(diag(L)))
loglik_marginal_NIW <- function(N, D, kappa, nu, S_chol, kappa0, nu0, S0_chol){
-0.5*N*D*log(pi) - 0.5*D*(log(kappa) - log(kappa0)) - 0.5*(nu*logdet_chol(S_chol) - nu0*logdet_chol(S0_chol)) + sum(lgamma(0.5*(nu - 1:D + 1)) - lgamma(0.5*(nu0 - 1:D + 1)))
}
add_sample_and... |
\name{countrycode_test}
\alias{countrycode_test}
\title{countrycode tests}
\usage{
countrycode_test()
}
\description{
Runs a series of tests. Returns TRUE if all tests passed.
Prints test description when some tests fail.
}
\keyword{countrycode_test}
| /man/countrycode_test.Rd | no_license | trcook/countrycode | R | false | false | 258 | rd | \name{countrycode_test}
\alias{countrycode_test}
\title{countrycode tests}
\usage{
countrycode_test()
}
\description{
Runs a series of tests. Returns TRUE if all tests passed.
Prints test description when some tests fail.
}
\keyword{countrycode_test}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.