content large_stringlengths 0 6.46M | path large_stringlengths 3 331 | license_type large_stringclasses 2
values | repo_name large_stringlengths 5 125 | language large_stringclasses 1
value | is_vendor bool 2
classes | is_generated bool 2
classes | length_bytes int64 4 6.46M | extension large_stringclasses 75
values | text stringlengths 0 6.46M |
|---|---|---|---|---|---|---|---|---|---|
context("Lines")
library(xml2)
test_that("segments don't have fill", {
x <- xmlSVG({
plot.new()
segments(0.5, 0.5, 1, 1)
})
style <- xml_text(xml_find_first(x, "//style"))
expect_match(style, "fill: none;")
expect_equal(style_attr(xml_find_first(x, ".//line"), "fill"), NA_character_)
})
test_that("l... | /tests/testthat/test-lines.R | no_license | yixuan/RSvgDevice | R | false | false | 4,165 | r | context("Lines")
library(xml2)
test_that("segments don't have fill", {
x <- xmlSVG({
plot.new()
segments(0.5, 0.5, 1, 1)
})
style <- xml_text(xml_find_first(x, "//style"))
expect_match(style, "fill: none;")
expect_equal(style_attr(xml_find_first(x, ".//line"), "fill"), NA_character_)
})
test_that("l... |
rm(list = ls())
require(googleVis)
require(shiny)
library(tidyr)
## Prepare data to be displayed
## Load presidential election data by state from 1932 - 2012
RepDir = "~/Dropbox/LEPR02/quidel/"
qdata = readRDS(paste0(RepDir,"Quidel_weekly.Rds"))
week = qdata$week
year = qdata$year
total.raw = qdata$Total
n = length(wee... | /quidel-other/shiny.R | no_license | yinzhuoding/Internship | R | false | false | 1,908 | r | rm(list = ls())
require(googleVis)
require(shiny)
library(tidyr)
## Prepare data to be displayed
## Load presidential election data by state from 1932 - 2012
RepDir = "~/Dropbox/LEPR02/quidel/"
qdata = readRDS(paste0(RepDir,"Quidel_weekly.Rds"))
week = qdata$week
year = qdata$year
total.raw = qdata$Total
n = length(wee... |
### Exercise 2 ###
# Load the httr and jsonlite libraries for accessing data
# Create a `base.uri` variable that holds the base uri. You will then paste endpoints to this base.
## As you may have noticed, it often takes multiple queries to retrieve the desired information.
## This is a perfect situation in which ... | /exercise-2/exercise.R | permissive | muiallen/ch11-apis | R | false | false | 1,077 | r | ### Exercise 2 ###
# Load the httr and jsonlite libraries for accessing data
# Create a `base.uri` variable that holds the base uri. You will then paste endpoints to this base.
## As you may have noticed, it often takes multiple queries to retrieve the desired information.
## This is a perfect situation in which ... |
\name{folderh}
\alias{folderh}
\title{
Hierarchic folder of n data frames related in pairs by (n-1) keys
}
\description{
Creates an object of class \code{folderh}, that is a list of \eqn{n>1} data frames whose rows are related by (n-1) keys, each key defining a relation "1 to N" between the two adjacent data frames... | /man/folderh.Rd | no_license | cran/dad | R | false | false | 3,560 | rd | \name{folderh}
\alias{folderh}
\title{
Hierarchic folder of n data frames related in pairs by (n-1) keys
}
\description{
Creates an object of class \code{folderh}, that is a list of \eqn{n>1} data frames whose rows are related by (n-1) keys, each key defining a relation "1 to N" between the two adjacent data frames... |
# install.packages('keras')
# install.packages('purrr')
# install.packages('functional')
library(MASS); library(e1071)
library(caret)
library(fGarch)
library(fitdistrplus)
library(pracma)
library(BBmisc)
library(functional)
library(dplyr)
library(keras)
library(lubridate)
library(tensorflow)
Sys.sleep(5)
install_tenso... | /bs1/w1000_trace-level/Model1_small.R | no_license | paai-lab/Online-Anomaly-Detection-Extension-2021 | R | false | false | 16,100 | r | # install.packages('keras')
# install.packages('purrr')
# install.packages('functional')
library(MASS); library(e1071)
library(caret)
library(fGarch)
library(fitdistrplus)
library(pracma)
library(BBmisc)
library(functional)
library(dplyr)
library(keras)
library(lubridate)
library(tensorflow)
Sys.sleep(5)
install_tenso... |
#====================================#
# ==== Understanding wfe package ====
#====================================#
# - Keywords
# - #set will be used for things that need to be set for your specific
# file structure to get the code to run. Things like data directories
# - #fix will be used for thin... | /Investigate packages/Understanding wfe.R | no_license | Nathan-Mather/Event_studies_and_friends | R | false | false | 4,767 | r | #====================================#
# ==== Understanding wfe package ====
#====================================#
# - Keywords
# - #set will be used for things that need to be set for your specific
# file structure to get the code to run. Things like data directories
# - #fix will be used for thin... |
source('file_reading.R')
source('build_model.R')
source('model_testing.R')
set.seed(123)
# lines <- load10kRandomTweets()
lines <- readWholeFile('.//data//final//en_US//en_US.twitter.txt')
#split train and test
lines <- sample(lines)
splitIndex <- floor(length(lines) * 0.2)
testLines <- lines[1:splitIndex]
trainLin... | /build_and_test_quick.R | no_license | tim-fan/coursera_datascience_capstone | R | false | false | 887 | r | source('file_reading.R')
source('build_model.R')
source('model_testing.R')
set.seed(123)
# lines <- load10kRandomTweets()
lines <- readWholeFile('.//data//final//en_US//en_US.twitter.txt')
#split train and test
lines <- sample(lines)
splitIndex <- floor(length(lines) * 0.2)
testLines <- lines[1:splitIndex]
trainLin... |
con <- connect_to_etn()
test_that("get_animal_projects() returns error for incorrect connection", {
expect_error(
get_animal_projects(con = "not_a_connection"),
"Not a connection object to database."
)
})
test_that("get_animal_projects() returns a tibble", {
df <- get_animal_projects(con)
expect_s3_cl... | /tests/testthat/test-get_animal_projects.R | permissive | inbo/etn | R | false | false | 2,250 | r | con <- connect_to_etn()
test_that("get_animal_projects() returns error for incorrect connection", {
expect_error(
get_animal_projects(con = "not_a_connection"),
"Not a connection object to database."
)
})
test_that("get_animal_projects() returns a tibble", {
df <- get_animal_projects(con)
expect_s3_cl... |
#Author: Thomas Hollis
#Subject: Bachelor Thesis
library(caret)
library(lattice)
library(forecast)
data <- read.csv("R/BTC.csv")
data_train <- data[1:282,2]
data_test <- data[283:376,2]
model <- nnetar(data_train)
xvalues <- seq(283,376,1)
plot(forecast(model,h=93), xlab = "Hours Elapsed", ylab = "... | /src/Ex5_NNTimeSeries.R | permissive | ipesTTH/Bachelor-Thesis | R | false | false | 713 | r | #Author: Thomas Hollis
#Subject: Bachelor Thesis
library(caret)
library(lattice)
library(forecast)
data <- read.csv("R/BTC.csv")
data_train <- data[1:282,2]
data_test <- data[283:376,2]
model <- nnetar(data_train)
xvalues <- seq(283,376,1)
plot(forecast(model,h=93), xlab = "Hours Elapsed", ylab = "... |
#' @title Interdaily Statbility
#' @description This function calcualte interdaily stability, a nonparametric metric
#' of circadian rhtymicity
#'
#' @param x \code{data.frame} of dimension ndays by p, where p is the dimension of the data.
#'
#' @references Junrui Di et al. Joint and individual representation of domai... | /R/IS.R | no_license | javybai/ActCR | R | false | false | 751 | r | #' @title Interdaily Statbility
#' @description This function calcualte interdaily stability, a nonparametric metric
#' of circadian rhtymicity
#'
#' @param x \code{data.frame} of dimension ndays by p, where p is the dimension of the data.
#'
#' @references Junrui Di et al. Joint and individual representation of domai... |
#####################################################
### Solution 1 #######
#####################################################
#####################################################
### step 1 #######
###########################################... | /estimationJob/New_simulation/NIG_GARCH_HN/NIG_GARCH_HN_ret_vix/Resultat_VIX_HN_normalised.R | no_license | Fanirisoa/dynamic_pricing | R | false | false | 2,049 | r | #####################################################
### Solution 1 #######
#####################################################
#####################################################
### step 1 #######
###########################################... |
library("readr")
library("dplyr")
library("reshape2")
library("tidyr")
library("rhandsontable")
library("shinyBS")
library("shinydashboard")
library("shinyjs")
library("V8")
library("markdown")
library("lazyeval")
library("rjson")
library("jsonlite")
library("forecast")
library("Rmisc")
library(NLP)
l... | /output/shiny/global.R | no_license | TZstatsADS/Fall2016-proj5-grp6 | R | false | false | 6,413 | r | library("readr")
library("dplyr")
library("reshape2")
library("tidyr")
library("rhandsontable")
library("shinyBS")
library("shinydashboard")
library("shinyjs")
library("V8")
library("markdown")
library("lazyeval")
library("rjson")
library("jsonlite")
library("forecast")
library("Rmisc")
library(NLP)
l... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.2d.R
\name{plot2d}
\alias{plot2d}
\title{Visualize optimization procedure in 2d contour plot}
\usage{
plot2d(
f,
x1.lower,
x1.upper,
x2.lower,
x2.upper,
n.x = 30L,
xmat,
trueOpt = NULL,
algoName = NULL,
plotSegments =... | /man/plot2d.Rd | no_license | PhilippScheller/visualDescend | R | false | true | 1,424 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.2d.R
\name{plot2d}
\alias{plot2d}
\title{Visualize optimization procedure in 2d contour plot}
\usage{
plot2d(
f,
x1.lower,
x1.upper,
x2.lower,
x2.upper,
n.x = 30L,
xmat,
trueOpt = NULL,
algoName = NULL,
plotSegments =... |
#
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
... | /Week1/myfirstshiny/ui.R | no_license | tiagocberti/DevDataProd | R | false | false | 825 | r | #
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
... |
# Tree model Maurits Leonardo
#Loading Packages
if(!require('ggplot2')){
install.packages('ggplot2')
require('ggplot2')
} else{require('ggplot2')}
if(!require('reshape2')){
install.packages('reshape2')
require('reshape2')
} else{require('reshape2')}
if(!require('scales')){
install.packages('scales')
requ... | /SetInputs.R | no_license | LeonardoReyes/TreeModel | R | false | false | 10,477 | r | # Tree model Maurits Leonardo
#Loading Packages
if(!require('ggplot2')){
install.packages('ggplot2')
require('ggplot2')
} else{require('ggplot2')}
if(!require('reshape2')){
install.packages('reshape2')
require('reshape2')
} else{require('reshape2')}
if(!require('scales')){
install.packages('scales')
requ... |
\name{rsem.lavaan}
\alias{rsem.lavaan}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Conduct robust SEM analysis using lavaan
}
\description{
Conduct robust SEM analysis using lavaan
}
\usage{
rsem.lavaan(dset, model, select, varphi=.1, max.it=1000)
}
%- maybe also 'usage' for other objects do... | /man/rsem.lavaan.Rd | no_license | cran/rsem | R | false | false | 1,302 | rd | \name{rsem.lavaan}
\alias{rsem.lavaan}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Conduct robust SEM analysis using lavaan
}
\description{
Conduct robust SEM analysis using lavaan
}
\usage{
rsem.lavaan(dset, model, select, varphi=.1, max.it=1000)
}
%- maybe also 'usage' for other objects do... |
# search 1 ----
# This sets the search behavior before each trip begins
# currently based upon a trip of 2.5 days
# and a catch of 50 t - the exvessel values and
# fuel costs are set for each model independently
# Initial starting functions
f.penalty <- function(x){
# assigns a 'penalty' in number of days travel to... | /code/functions/gridsearch.R | no_license | ben-williams/parallel_diverge | R | false | false | 3,092 | r | # search 1 ----
# This sets the search behavior before each trip begins
# currently based upon a trip of 2.5 days
# and a catch of 50 t - the exvessel values and
# fuel costs are set for each model independently
# Initial starting functions
f.penalty <- function(x){
# assigns a 'penalty' in number of days travel to... |
#' Run make within a package directory
#'
#' Run make within a package directory
#'
#' @param pkg Path to directory containing the GNU Make file, or an
#' Rpackage description, which can be a path or a package name. (See
#' [devtools::as.package()] for more information.)
#'
#' @param makefile File name of makefile.
#'
... | /R/make.R | no_license | cran/broman | R | false | false | 1,376 | r | #' Run make within a package directory
#'
#' Run make within a package directory
#'
#' @param pkg Path to directory containing the GNU Make file, or an
#' Rpackage description, which can be a path or a package name. (See
#' [devtools::as.package()] for more information.)
#'
#' @param makefile File name of makefile.
#'
... |
library(apa)
### Name: cor_apa
### Title: Report Correlation in APA style
### Aliases: cor_apa
### ** Examples
# Example data from ?cor.test
x <- c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1)
y <- c( 2.6, 3.1, 2.5, 5.0, 3.6, 4.0, 5.2, 2.8, 3.8)
cor_apa(cor.test(x, y))
# Spearman's rho
cor_apa(co... | /data/genthat_extracted_code/apa/examples/cor_apa.Rd.R | no_license | surayaaramli/typeRrh | R | false | false | 420 | r | library(apa)
### Name: cor_apa
### Title: Report Correlation in APA style
### Aliases: cor_apa
### ** Examples
# Example data from ?cor.test
x <- c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1)
y <- c( 2.6, 3.1, 2.5, 5.0, 3.6, 4.0, 5.2, 2.8, 3.8)
cor_apa(cor.test(x, y))
# Spearman's rho
cor_apa(co... |
## from the tools package
file_ext <- function (x) {
pos <- regexpr("\\.([[:alnum:]]+)$", x)
ifelse(pos > -1L, substring(x, pos + 1L), "")
}
#' @importFrom tools file_path_sans_ext
getdocvarsFromFilenames <- function(fnames, dvsep="_", docvarnames=NULL) {
snames <- fnames
snames <- tools::file_path_sa... | /R/utils.R | no_license | jay134679/readtext | R | false | false | 10,340 | r |
## from the tools package
file_ext <- function (x) {
pos <- regexpr("\\.([[:alnum:]]+)$", x)
ifelse(pos > -1L, substring(x, pos + 1L), "")
}
#' @importFrom tools file_path_sans_ext
getdocvarsFromFilenames <- function(fnames, dvsep="_", docvarnames=NULL) {
snames <- fnames
snames <- tools::file_path_sa... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fortify_base.R
\name{autoplot.matrix}
\alias{autoplot.matrix}
\title{Plot \code{base::matrix}}
\usage{
\method{autoplot}{matrix}(object, original = NULL, geom = "tile",
colour = NULL, size = NULL, alpha = NULL, fill = "#0000FF",
shape = N... | /man/autoplot.matrix.Rd | no_license | inambioinfo/ggfortify | R | false | true | 2,526 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fortify_base.R
\name{autoplot.matrix}
\alias{autoplot.matrix}
\title{Plot \code{base::matrix}}
\usage{
\method{autoplot}{matrix}(object, original = NULL, geom = "tile",
colour = NULL, size = NULL, alpha = NULL, fill = "#0000FF",
shape = N... |
buildDocumentation <- function(target) {
# this should probably be run from a fresh copy of R
indextext <- "<html>\n<head>\n<title>Jasper version 2</title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">\n</head>\n<h1>Jasper</h1>\n</br>"
# load the standard varnames
std_vars <- read.csv(paste(... | /R/buildDocumentation.r | no_license | arnhew99/Jasper | R | false | false | 3,754 | r | buildDocumentation <- function(target) {
# this should probably be run from a fresh copy of R
indextext <- "<html>\n<head>\n<title>Jasper version 2</title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">\n</head>\n<h1>Jasper</h1>\n</br>"
# load the standard varnames
std_vars <- read.csv(paste(... |
## This pair of function cache the value of a computed inverse of a matrix A, rather than repeatidely computing it: Extremely usefull especially if the matrix doesn't change often. If the matrix does change, the function comupte and cache the new inverse of the matrix A.
## NOTICE : I'm using the function ginv() from... | /cachematrix.R | no_license | tkoutangni/ProgrammingAssignment2 | R | false | false | 2,145 | r | ## This pair of function cache the value of a computed inverse of a matrix A, rather than repeatidely computing it: Extremely usefull especially if the matrix doesn't change often. If the matrix does change, the function comupte and cache the new inverse of the matrix A.
## NOTICE : I'm using the function ginv() from... |
### =========================================================================
### Utility functions for checking/fixing user-supplied arguments
### -------------------------------------------------------------------------
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### For checking o... | /R/normarg-utils.R | no_license | genome-vendor/r-bioc-iranges | R | false | false | 10,239 | r | ### =========================================================================
### Utility functions for checking/fixing user-supplied arguments
### -------------------------------------------------------------------------
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### For checking o... |
emf.rna.backward.padrao <- function (
rna,
padrao = NULL, #Registro, ou colecao de 1 a N, padrao a padrao
alpha.min = 0.1,
alpha.max = 0.9,
camada1 = TRUE,
camada2 = TRUE
)
{
if(is.null(padrao)){ #Se nao passou o padrao, faz todos
padrao = 1 : dim(rna$X)[1]
}
for(pad in padr... | /R/emf.rna.backward.padrao.R | no_license | elthonf/Rna-em-R | R | false | false | 2,488 | r | emf.rna.backward.padrao <- function (
rna,
padrao = NULL, #Registro, ou colecao de 1 a N, padrao a padrao
alpha.min = 0.1,
alpha.max = 0.9,
camada1 = TRUE,
camada2 = TRUE
)
{
if(is.null(padrao)){ #Se nao passou o padrao, faz todos
padrao = 1 : dim(rna$X)[1]
}
for(pad in padr... |
# Creating plot 3
# Line chart of the 3 Sub_metering variables by days of the week
# Download of the data, reading it and building the basic data set
# for plotting, is done in "png1.R". Please run that script first.
# Creating the basic and empty plot
with(data, plot(full_date, as.numeric(as.character(Sub_metering_1... | /plot3.R | no_license | ypridor/ExData_Plotting1 | R | false | false | 967 | r | # Creating plot 3
# Line chart of the 3 Sub_metering variables by days of the week
# Download of the data, reading it and building the basic data set
# for plotting, is done in "png1.R". Please run that script first.
# Creating the basic and empty plot
with(data, plot(full_date, as.numeric(as.character(Sub_metering_1... |
library(tidyverse)
library(gridExtra)
#library(reshape2)
#vzorčni testni podatki
#"date","pce","pop","psavert","uempmed","unemploy"
df <- data.frame(datum = economics$date,
populacija = economics$pop,
nezaposleni = economics$unemploy,
stringsAsFactors=FALSE)
df <- ... | /tmp/Testiranje2.R | no_license | SlanaD/slanad_blog | R | false | false | 2,680 | r | library(tidyverse)
library(gridExtra)
#library(reshape2)
#vzorčni testni podatki
#"date","pce","pop","psavert","uempmed","unemploy"
df <- data.frame(datum = economics$date,
populacija = economics$pop,
nezaposleni = economics$unemploy,
stringsAsFactors=FALSE)
df <- ... |
## 1(a-b)
##build the columns, in to vectors
color <- c(rep('black', 26), rep('red', 26))
suit<-c(rep("clubs",13),rep("spades",13),rep("diamonds",13),rep("hearts",13))
name<-paste(rep(c("ace",2:10, c("jack","queen", "king")),4))
value<-rep(c(c(1:9),rep(10,4)),4)
rank<-c(rep(1:13,4))
## check for each vector(... | /quiz.deck52.ADEWUYA.R | no_license | petrosag/Deck-of-cards-with-R | R | false | false | 1,475 | r | ## 1(a-b)
##build the columns, in to vectors
color <- c(rep('black', 26), rep('red', 26))
suit<-c(rep("clubs",13),rep("spades",13),rep("diamonds",13),rep("hearts",13))
name<-paste(rep(c("ace",2:10, c("jack","queen", "king")),4))
value<-rep(c(c(1:9),rep(10,4)),4)
rank<-c(rep(1:13,4))
## check for each vector(... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/stretch_nltt_matrix.R
\name{stretch_nltt_matrix}
\alias{stretch_nltt_matrix}
\title{Stretch matrix 'm' with a timestep resolution of 'dt'.}
\usage{
stretch_nltt_matrix(m, dt, step_type)
}
\arguments{
\item{m}{A matrix of 2 columns and at leas... | /man/stretch_nltt_matrix.Rd | no_license | cran/nLTT | R | false | true | 1,189 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/stretch_nltt_matrix.R
\name{stretch_nltt_matrix}
\alias{stretch_nltt_matrix}
\title{Stretch matrix 'm' with a timestep resolution of 'dt'.}
\usage{
stretch_nltt_matrix(m, dt, step_type)
}
\arguments{
\item{m}{A matrix of 2 columns and at leas... |
testlist <- list(m = NULL, repetitions = 0L, in_m = structure(c(2.05469505011e-81, 3.38461625700536e+125, 6.05877837174133e-280, 8.3251471601561e-256, 8.37742793800141e+298, 0, 0), .Dim = c(1L, 7L)))
result <- do.call(CNull:::communities_individual_based_sampling_alpha,testlist)
str(result) | /CNull/inst/testfiles/communities_individual_based_sampling_alpha/AFL_communities_individual_based_sampling_alpha/communities_individual_based_sampling_alpha_valgrind_files/1615773336-test.R | no_license | akhikolla/updatedatatype-list2 | R | false | false | 293 | r | testlist <- list(m = NULL, repetitions = 0L, in_m = structure(c(2.05469505011e-81, 3.38461625700536e+125, 6.05877837174133e-280, 8.3251471601561e-256, 8.37742793800141e+298, 0, 0), .Dim = c(1L, 7L)))
result <- do.call(CNull:::communities_individual_based_sampling_alpha,testlist)
str(result) |
library(randomLCA)
### Name: refit
### Title: Refit an randomLCA object
### Aliases: refit refit.randomLCA
### Keywords: methods
### ** Examples
## Not run:
##D myocardial.lca1 <- randomLCA(myocardial[,1:4],freq=myocardial$freq,nclass=1)
##D myocardial.lca2 <- randomLCA(myocardial[,1:4],freq=myocardial$freq)
##D #... | /data/genthat_extracted_code/randomLCA/examples/refit.Rd.R | no_license | surayaaramli/typeRrh | R | false | false | 1,070 | r | library(randomLCA)
### Name: refit
### Title: Refit an randomLCA object
### Aliases: refit refit.randomLCA
### Keywords: methods
### ** Examples
## Not run:
##D myocardial.lca1 <- randomLCA(myocardial[,1:4],freq=myocardial$freq,nclass=1)
##D myocardial.lca2 <- randomLCA(myocardial[,1:4],freq=myocardial$freq)
##D #... |
library(magrittr)
input <- readLines("~/R Projects/adventofcode/2020/Input/2020_d3_input.txt") #Read Input
# Part 1 ------------------------------------------------------------------
for(i in 1:length(input)){
row <- input[i] #iterate through each row
position <- 1 + ((i-1) * 3) #Count trees at this posit... | /2020/Solutions/2020_d3.R | no_license | Cattiva/adventofcode | R | false | false | 3,631 | r | library(magrittr)
input <- readLines("~/R Projects/adventofcode/2020/Input/2020_d3_input.txt") #Read Input
# Part 1 ------------------------------------------------------------------
for(i in 1:length(input)){
row <- input[i] #iterate through each row
position <- 1 + ((i-1) * 3) #Count trees at this posit... |
###### Feature Source Map #######
featSourceMap <- function(dt) {
arrange(dt,-Gain)
setDT(dt)
# Palette ----------------------------
# Base palette
base.palette <- c("#D31111","#3E273E","#3EA5A5","#A58053","#3E5641")
# Add grey for "OTHER" vars
plot.palette <- c(base.palette[1:nrow(dt[,.N,by=So... | /featureSourceMap.R | no_license | ajphilpotts/DataVisualisationR | R | false | false | 1,796 | r |
###### Feature Source Map #######
featSourceMap <- function(dt) {
arrange(dt,-Gain)
setDT(dt)
# Palette ----------------------------
# Base palette
base.palette <- c("#D31111","#3E273E","#3EA5A5","#A58053","#3E5641")
# Add grey for "OTHER" vars
plot.palette <- c(base.palette[1:nrow(dt[,.N,by=So... |
###--- BSCmultimodal by Xu Yafei HU Berlin
library(rgl)
ng=33 # number of grid
x=seq(0,5,length.out=ng) # grid elements
y=seq(0,5,length.out=ng)
###
fhat=function(x,y){
v=numeric()
v=0.03*sin(x)*sin(y)-0.05*sin(2*x)*sin(y)+0.01*sin(x)*sin(2*y)+0.09*sin(2*x)*sin(2*y)
return(v)
}
###
outer931=outer(x,y,fhat)
###
op... | /BSCmultimodal.r | no_license | YafeiXu/bscQuantlet | R | false | false | 5,765 | r | ###--- BSCmultimodal by Xu Yafei HU Berlin
library(rgl)
ng=33 # number of grid
x=seq(0,5,length.out=ng) # grid elements
y=seq(0,5,length.out=ng)
###
fhat=function(x,y){
v=numeric()
v=0.03*sin(x)*sin(y)-0.05*sin(2*x)*sin(y)+0.01*sin(x)*sin(2*y)+0.09*sin(2*x)*sin(2*y)
return(v)
}
###
outer931=outer(x,y,fhat)
###
op... |
library(mfbvar)
context("Output")
test_that("Output correct", {
set.seed(10237)
Y <- mfbvar::mf_sweden
prior_obj <- set_prior(Y = Y, freq = c(rep("m", 4), "q"),
n_lags = 4, n_burnin = 100, n_reps = 300)
prior_intervals <- matrix(c( 6, 7,
... | /tests/testthat/test_mfbvar.R | no_license | szferi/mfbvar | R | false | false | 6,917 | r | library(mfbvar)
context("Output")
test_that("Output correct", {
set.seed(10237)
Y <- mfbvar::mf_sweden
prior_obj <- set_prior(Y = Y, freq = c(rep("m", 4), "q"),
n_lags = 4, n_burnin = 100, n_reps = 300)
prior_intervals <- matrix(c( 6, 7,
... |
library(glmnet)
mydata = read.table("../../../../TrainingSet/FullSet/ReliefF/urinary_tract.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="mae",alpha=0.3,family="gaussian",standardize=TRUE)
sink('./urinary_tract_043.txt',app... | /Model/EN/ReliefF/urinary_tract/urinary_tract_043.R | no_license | esbgkannan/QSMART | R | false | false | 359 | r | library(glmnet)
mydata = read.table("../../../../TrainingSet/FullSet/ReliefF/urinary_tract.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="mae",alpha=0.3,family="gaussian",standardize=TRUE)
sink('./urinary_tract_043.txt',app... |
ChaoShared.Sam <-
function(y1, y2, method = c("all",
"Chao2-shared",
"Chao2-shared-bc",
"Lower-bound",
"Lower-bound-bc"),
... | /R/ChaoShared.Sam.R | no_license | JohnsonHsieh/SpadeR | R | false | false | 998 | r | ChaoShared.Sam <-
function(y1, y2, method = c("all",
"Chao2-shared",
"Chao2-shared-bc",
"Lower-bound",
"Lower-bound-bc"),
... |
##### Source code on Machine Learning Project On Cab fare Prediction Using R #####
##### Removing all the previous objects From R environment #####
rm(list=ls())
### Setting the working diretory and importing the required Dataset ###
setwd("D:/python & R/Projects/Cab Fare Prediction")
train_set=read.csv("tra... | /Cab Fare Prediction/Cab Fare Prediction in Ripynb.R | no_license | IBSJaanviArora/Cab-Fare-Prediction | R | false | false | 5,327 | r | ##### Source code on Machine Learning Project On Cab fare Prediction Using R #####
##### Removing all the previous objects From R environment #####
rm(list=ls())
### Setting the working diretory and importing the required Dataset ###
setwd("D:/python & R/Projects/Cab Fare Prediction")
train_set=read.csv("tra... |
#' Retrieve a pin (legacy API)
#'
#' Retrieves a pin by name from the local or given board.
#'
#' @param name The name of the pin.
#' @param board The board where this pin will be retrieved from.
#' @param cache Should the pin cache be used? Defaults to `TRUE`.
#' @param extract Should compressed files be extracted? Ea... | /R/pin_get.R | no_license | cran/pins | R | false | false | 2,335 | r | #' Retrieve a pin (legacy API)
#'
#' Retrieves a pin by name from the local or given board.
#'
#' @param name The name of the pin.
#' @param board The board where this pin will be retrieved from.
#' @param cache Should the pin cache be used? Defaults to `TRUE`.
#' @param extract Should compressed files be extracted? Ea... |
# runFixAlleles - find the dominant allele of each gene after running the igblast
#
# params -
# igblastFile - the csv files that created after running the igblast.
# out.dir - the directory of the csv file
runFixAlleles<- function(igblastFile, out.dir){
out.name<-NULL
df.igblast<- NULL
#merage all the igblas... | /fixing_alleles.R | no_license | adarmaximov/clonal_analysis | R | false | false | 2,514 | r | # runFixAlleles - find the dominant allele of each gene after running the igblast
#
# params -
# igblastFile - the csv files that created after running the igblast.
# out.dir - the directory of the csv file
runFixAlleles<- function(igblastFile, out.dir){
out.name<-NULL
df.igblast<- NULL
#merage all the igblas... |
## Put comments here that give an overall description of what your
## functions do
## This function creates a special matrix and sets the value of its inverse
makeCacheMatrix <- function(x = matrix()) {
inv <- NULL
set <- function(y) {
x <<- y
inv <<- NULL
}
get <- function() x
setinv <- functio... | /cachematrix.R | no_license | aqilyas/ProgrammingAssignment2 | R | false | false | 823 | r | ## Put comments here that give an overall description of what your
## functions do
## This function creates a special matrix and sets the value of its inverse
makeCacheMatrix <- function(x = matrix()) {
inv <- NULL
set <- function(y) {
x <<- y
inv <<- NULL
}
get <- function() x
setinv <- functio... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.R
\name{line_chart_.Survey}
\alias{line_chart_.Survey}
\title{Using line_chart_ with a Survey}
\usage{
\method{line_chart_}{Survey}(df, vars, groups = NULL, weight = NULL,
margin = TRUE, margin_name = NULL, wrap = FALSE)
}
\arguments{
... | /man/line_chart_.Survey.Rd | no_license | itsdalmo/reporttoolDT | R | false | true | 1,015 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.R
\name{line_chart_.Survey}
\alias{line_chart_.Survey}
\title{Using line_chart_ with a Survey}
\usage{
\method{line_chart_}{Survey}(df, vars, groups = NULL, weight = NULL,
margin = TRUE, margin_name = NULL, wrap = FALSE)
}
\arguments{
... |
stratamean <-
function(y, h, Nh, wh, level = 0.95, eae = FALSE)
{
### input treatment
# data and strata
if(!(is.numeric(y) && is.vector(y))){
stop("Invalid input: ", sQuote("y"), " has to be a numeric vector of observations.")
}
if(!is.vector(h)){
stop("Invalid input: ", sQuote("h"), " has to be a ve... | /R/stratamean.R | no_license | cran/samplingbook | R | false | false | 3,052 | r | stratamean <-
function(y, h, Nh, wh, level = 0.95, eae = FALSE)
{
### input treatment
# data and strata
if(!(is.numeric(y) && is.vector(y))){
stop("Invalid input: ", sQuote("y"), " has to be a numeric vector of observations.")
}
if(!is.vector(h)){
stop("Invalid input: ", sQuote("h"), " has to be a ve... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/manual.R
\name{correct_failures}
\alias{correct_failures}
\title{Manually correct failures after automatic trim detection}
\usage{
correct_failures(dp.trimmed)
}
\arguments{
\item{dp.trimmed}{A list of dp objects, trimmed, with the report
emb... | /man/correct_failures.Rd | no_license | cran/densitr | R | false | true | 1,558 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/manual.R
\name{correct_failures}
\alias{correct_failures}
\title{Manually correct failures after automatic trim detection}
\usage{
correct_failures(dp.trimmed)
}
\arguments{
\item{dp.trimmed}{A list of dp objects, trimmed, with the report
emb... |
sim = read_output(output_file_name)
plot_all(sim)
library(stringr)
columns = str_detect(colnames(sim), "outflowTotal")
totals = tail(sim[,columns],1)
print(totals)
print(sum(totals))
| /src/resources/data/input/book/phys-dev-appl-5-end.R | no_license | NielsHolst/UniSim2 | R | false | false | 184 | r | sim = read_output(output_file_name)
plot_all(sim)
library(stringr)
columns = str_detect(colnames(sim), "outflowTotal")
totals = tail(sim[,columns],1)
print(totals)
print(sum(totals))
|
##Script to generate daily temperature anomaly time-series for all stations.
library(xts)
library(dplyr)
setwd("~/Dropbox/Lab/EcoForecasting_SDD_Phenology (1)/Data&Analysis/Microclimate/raw/")
source("~/code/MORA_microclimate/air_temp_functions.R")
## Loads and formats data.
tavg <- read.csv("../cleaned/tavg_daily_all... | /create_daily_anomalies.R | no_license | ibreckhe/MORA_microclimate | R | false | false | 10,951 | r | ##Script to generate daily temperature anomaly time-series for all stations.
library(xts)
library(dplyr)
setwd("~/Dropbox/Lab/EcoForecasting_SDD_Phenology (1)/Data&Analysis/Microclimate/raw/")
source("~/code/MORA_microclimate/air_temp_functions.R")
## Loads and formats data.
tavg <- read.csv("../cleaned/tavg_daily_all... |
library(shiny)
shinyUI(fluidPage(
headerPanel("Urine Kidney Inflammatory Prediction Test using a panel of 11 expressed genes" ),
sidebarPanel(
# Selector for file upload
<<<<<<< HEAD
h4("Choose All files option after clicking Choose File below", style= "color:red"),
fileInput("datafile",'\... | /ui.R | no_license | timt99/DataProduct | R | false | false | 4,325 | r | library(shiny)
shinyUI(fluidPage(
headerPanel("Urine Kidney Inflammatory Prediction Test using a panel of 11 expressed genes" ),
sidebarPanel(
# Selector for file upload
<<<<<<< HEAD
h4("Choose All files option after clicking Choose File below", style= "color:red"),
fileInput("datafile",'\... |
library(tidyverse)
#Part1 data
annaulTemprature <- read_csv("annaulTemprature.csv")
annaulTemprature <- annaulTemprature[,-1]
#Part2 data
ex9 <- read_csv("ex9.csv")
ex9 <- subset(ex9[,-1])
tox1 <- read_csv("toxicity.csv")
tox1 <- subset(tox1[,-1])
#SHINY DASHBOARD
##using ex10 data
library(shinydashboard)
library(s... | /shiny_BothParts.R | no_license | yinchia0518/MA615_Assignment5 | R | false | false | 6,217 | r | library(tidyverse)
#Part1 data
annaulTemprature <- read_csv("annaulTemprature.csv")
annaulTemprature <- annaulTemprature[,-1]
#Part2 data
ex9 <- read_csv("ex9.csv")
ex9 <- subset(ex9[,-1])
tox1 <- read_csv("toxicity.csv")
tox1 <- subset(tox1[,-1])
#SHINY DASHBOARD
##using ex10 data
library(shinydashboard)
library(s... |
### general tests---------------------------
#setwd("C:/Aendu_lokal/SWMM_WB/Input_Files")
paths_list <- list(
model_dir = "C:/Aendu_lokal/SWMM_WB/Input_Files",
model_name = "Testgebiet_LID_andi",
model_inp = "<model_dir>/<model_name>.inp",
model_out = "<model_dir>/<model_name>.out",
model_rpt = "<model_d... | /R/.andis_playground.R | permissive | KWB-R/kwb.swmm | R | false | false | 3,163 | r |
### general tests---------------------------
#setwd("C:/Aendu_lokal/SWMM_WB/Input_Files")
paths_list <- list(
model_dir = "C:/Aendu_lokal/SWMM_WB/Input_Files",
model_name = "Testgebiet_LID_andi",
model_inp = "<model_dir>/<model_name>.inp",
model_out = "<model_dir>/<model_name>.out",
model_rpt = "<model_d... |
c DCNF-Autarky [version 0.0.1].
c Copyright (c) 2018-2019 Swansea University.
c
c Input Clause Count: 28219
c Performing E1-Autarky iteration.
c Remaining clauses count after E-Reduction: 23096
c
c Performing E1-Autarky iteration.
c Remaining clauses count after E-Reduction: 23096
c
c Input Parameter (command line, ... | /code/dcnf-ankit-optimized/Results/QBFLIB-2018/E1/Experiments/Kronegger-Pfandler-Pichler/dungeon/dungeon_i15-m7-u4-v0.pddl_planlen=22/dungeon_i15-m7-u4-v0.pddl_planlen=22.R | no_license | arey0pushpa/dcnf-autarky | R | false | false | 25,518 | r | c DCNF-Autarky [version 0.0.1].
c Copyright (c) 2018-2019 Swansea University.
c
c Input Clause Count: 28219
c Performing E1-Autarky iteration.
c Remaining clauses count after E-Reduction: 23096
c
c Performing E1-Autarky iteration.
c Remaining clauses count after E-Reduction: 23096
c
c Input Parameter (command line, ... |
#' @rdname popStructStat
#' @export
#'
Hstats <- function(g) {
if(ploidy(g) < 2) {
result <- matrix(NA, nrow = 3, ncol = nLoc(g))
rownames(result) <- c("Ho", "Hs", "Ht")
colnames(result) <- locNames(g)
return(result)
}
result <- Hstats_C(
sapply(loci(g), function(x) as.numeric(x) - 1),
... | /strataG/R/Hstats.R | no_license | ingted/R-Examples | R | false | false | 1,878 | r | #' @rdname popStructStat
#' @export
#'
Hstats <- function(g) {
if(ploidy(g) < 2) {
result <- matrix(NA, nrow = 3, ncol = nLoc(g))
rownames(result) <- c("Ho", "Hs", "Ht")
colnames(result) <- locNames(g)
return(result)
}
result <- Hstats_C(
sapply(loci(g), function(x) as.numeric(x) - 1),
... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/msmediate.R
\name{vartest.msmediate.weights}
\alias{vartest.msmediate.weights}
\title{Variance testing for multisite causal mediation analysis in the presence of complex sample and survey designs and non-random nonresponse}
\usage{
vart... | /man/vartest.msmediate.weights.Rd | no_license | cran/MultisiteMediation | R | false | true | 3,382 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/msmediate.R
\name{vartest.msmediate.weights}
\alias{vartest.msmediate.weights}
\title{Variance testing for multisite causal mediation analysis in the presence of complex sample and survey designs and non-random nonresponse}
\usage{
vart... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AICc.R, R/BIC.R, R/logLik_gambin.R
\name{AIC.gambin}
\alias{AIC.gambin}
\alias{AICc}
\alias{AICc.gambin}
\alias{BIC.gambin}
\alias{logLik.gambin}
\title{Likelihood statistics for the GamBin model}
\usage{
\method{AIC}{gambin}(object... | /man/logLik.gambin.Rd | no_license | cran/gambin | R | false | true | 1,105 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AICc.R, R/BIC.R, R/logLik_gambin.R
\name{AIC.gambin}
\alias{AIC.gambin}
\alias{AICc}
\alias{AICc.gambin}
\alias{BIC.gambin}
\alias{logLik.gambin}
\title{Likelihood statistics for the GamBin model}
\usage{
\method{AIC}{gambin}(object... |
# model training for Asia keywords
# using DTM object from clean_preprocess_viz.R
dtm <- corp %>%
tokens(
remove_punct = TRUE,
remove_numbers = TRUE,
remove_symbols = TRUE
) %>%
dfm(
remove = c(stopwords('english'), all_country_keywords)
)
dtm <- dfm_trim(dtm, min_termfreq = 50,
... | /src/supervised_models/supervised_Asia.R | no_license | mclaire19/migration-news-NLP | R | false | false | 1,698 | r | # model training for Asia keywords
# using DTM object from clean_preprocess_viz.R
dtm <- corp %>%
tokens(
remove_punct = TRUE,
remove_numbers = TRUE,
remove_symbols = TRUE
) %>%
dfm(
remove = c(stopwords('english'), all_country_keywords)
)
dtm <- dfm_trim(dtm, min_termfreq = 50,
... |
# Generate the data--Simulation
# Scenario 2: D is dependent of V
N=9000;n=300;clusterN=N/n
study_id<-c(rep(1:clusterN,each=n))
ind_id<-c(1:N)
v1_bar<-rnorm(clusterN,mean=0.3,sd=0.3)
v1<-rep(v1_bar,each=n)
#r1=1-->resistant to a1
r1<-rbinom(N,1,0.25)
r2<-rbinom(N,1,0.30)
r3<-rbinom(N,1,0.25)
d1_b... | /Generate_S2_30.R | no_license | Guanbo-W/MDR-TB_TMLE | R | false | false | 1,387 | r | # Generate the data--Simulation
# Scenario 2: D is dependent of V
N=9000;n=300;clusterN=N/n
study_id<-c(rep(1:clusterN,each=n))
ind_id<-c(1:N)
v1_bar<-rnorm(clusterN,mean=0.3,sd=0.3)
v1<-rep(v1_bar,each=n)
#r1=1-->resistant to a1
r1<-rbinom(N,1,0.25)
r2<-rbinom(N,1,0.30)
r3<-rbinom(N,1,0.25)
d1_b... |
# Load packages
rm(list=ls())
library(rjags)
library(jagsUI)
library(dplyr)
library(rtrim)
# Model 3 (autoregressive simple), adding the calculation of the Bayesian p-values
###################################################################
## Prepare data ###
######... | /Ch. 2-3/Ch. 2/3.2. CompareMethods.r | no_license | anasanz/MyScripts | R | false | false | 19,779 | r | # Load packages
rm(list=ls())
library(rjags)
library(jagsUI)
library(dplyr)
library(rtrim)
# Model 3 (autoregressive simple), adding the calculation of the Bayesian p-values
###################################################################
## Prepare data ###
######... |
% Auto-generated: do not edit by hand
\name{htmlH2}
\alias{htmlH2}
\title{H2 component}
\description{
H2 is a wrapper for the <h2> HTML5 element. For detailed attribute info see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h2
}
\usage{
htmlH2(children=NULL, id=NULL, n_clicks=NULL, n_clicks_timestamp=N... | /man/htmlH2.Rd | permissive | KirosG/dash-html-components | R | false | false | 3,082 | rd | % Auto-generated: do not edit by hand
\name{htmlH2}
\alias{htmlH2}
\title{H2 component}
\description{
H2 is a wrapper for the <h2> HTML5 element. For detailed attribute info see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/h2
}
\usage{
htmlH2(children=NULL, id=NULL, n_clicks=NULL, n_clicks_timestamp=N... |
\name{VIH}
\docType{data}
\alias{VIH}
\title{Sport et VIH}
\description{
Ce jeu de donnees est un extrait de l'enquete "Situation des personnes vivant avec le VIH dans l'acces aux activites physiques et sportives"
menee par le laboratoire Santesih (Universite Montpellier 1) et le Reseau National de person... | /man/VIH.Rd | no_license | cran/RcmdrPlugin.pointG | R | false | false | 989 | rd | \name{VIH}
\docType{data}
\alias{VIH}
\title{Sport et VIH}
\description{
Ce jeu de donnees est un extrait de l'enquete "Situation des personnes vivant avec le VIH dans l'acces aux activites physiques et sportives"
menee par le laboratoire Santesih (Universite Montpellier 1) et le Reseau National de person... |
fluidPage(theme = shinytheme(theme = "journal"),
titlePanel('ENEM 2016'),
sidebarLayout(
sidebarPanel(
selectInput(inputId='banco',label='Selecione o banco de dados',
choices=c('Selecione uma opção'='default','Quem presta o ENEM'='geral',
'Quem são os melh... | /ui.R | no_license | arzevedo/shiny_enem | R | false | false | 1,646 | r | fluidPage(theme = shinytheme(theme = "journal"),
titlePanel('ENEM 2016'),
sidebarLayout(
sidebarPanel(
selectInput(inputId='banco',label='Selecione o banco de dados',
choices=c('Selecione uma opção'='default','Quem presta o ENEM'='geral',
'Quem são os melh... |
source("model.R")
args = commandArgs(trailingOnly=TRUE)
genotypefile=args[1]
phenotypefile=args[2]
outfile=args[3]
####training dataset
SNPdata<-read.table(genotypefile,head = T)
pheno<-read.table(phenotypefile,head = F)
trainX<-SNPdata[,-c(1:6)]
trainY<-pheno[,3]
####learn elastic net model from training data
resul... | /model/model_run.R | no_license | jhuhan/iMWAS | R | false | false | 419 | r | source("model.R")
args = commandArgs(trailingOnly=TRUE)
genotypefile=args[1]
phenotypefile=args[2]
outfile=args[3]
####training dataset
SNPdata<-read.table(genotypefile,head = T)
pheno<-read.table(phenotypefile,head = F)
trainX<-SNPdata[,-c(1:6)]
trainY<-pheno[,3]
####learn elastic net model from training data
resul... |
\name{ec.proportion}
\alias{ec.proportion}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Descriptive Statistiques : }
\description{
TODO
}
\usage{ec.proportion(c)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
\item{c}{
%% ~~Describe \code{c} here~~
}
}
\details{
TO... | /man/ec.proportion.Rd | no_license | Epiconcept-Paris/Epiconcepts | R | false | false | 676 | rd | \name{ec.proportion}
\alias{ec.proportion}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Descriptive Statistiques : }
\description{
TODO
}
\usage{ec.proportion(c)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
\item{c}{
%% ~~Describe \code{c} here~~
}
}
\details{
TO... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spatialdemography.r
\name{env.type}
\alias{env.type}
\title{env.type input}
\description{
env.type determines how each landscape element will be set up.
}
\details{
Any of the distribution functions (see
\link[spatialdemography]{dis... | /man/env.type.Rd | no_license | akeyel/spatialdemography | R | false | true | 1,626 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spatialdemography.r
\name{env.type}
\alias{env.type}
\title{env.type input}
\description{
env.type determines how each landscape element will be set up.
}
\details{
Any of the distribution functions (see
\link[spatialdemography]{dis... |
madlibRhyme <- function(rhymenum, words){
# words = [person], [place], [animal], [adj],
# [adj], [adj], [present verb], [past verb], [past verb]
if(rhymenum == 1){
line1 <- paste(words[1],", ", words[1], ", pumpkin eater,", sep = "")
line2 <- paste(words[8], " a ", words[3]," and couldn\'t keep... | /madlibRhyme.R | no_license | sassychemist/Mad_Lib_ShinyApp | R | false | false | 1,360 | r | madlibRhyme <- function(rhymenum, words){
# words = [person], [place], [animal], [adj],
# [adj], [adj], [present verb], [past verb], [past verb]
if(rhymenum == 1){
line1 <- paste(words[1],", ", words[1], ", pumpkin eater,", sep = "")
line2 <- paste(words[8], " a ", words[3]," and couldn\'t keep... |
cents <- rgdal::readOGR(dsn = "pct-data/national/cents.geojson", layer = "OGRGeoJSON")
crs <- CRS("+init=epsg:4326")
crsuk <- CRS("+init=epsg:27700")
cents <- sp::spTransform(x = cents, CRSobj = crsuk)
home <- ggmap::geocode("LS7 3HB")
home <- sp::SpatialPoints(coords = home, proj4string = crs)
home <- sp::spTransform(... | /minidocs/stplan-data.R | permissive | Robinlovelace/pct | R | false | false | 485 | r | cents <- rgdal::readOGR(dsn = "pct-data/national/cents.geojson", layer = "OGRGeoJSON")
crs <- CRS("+init=epsg:4326")
crsuk <- CRS("+init=epsg:27700")
cents <- sp::spTransform(x = cents, CRSobj = crsuk)
home <- ggmap::geocode("LS7 3HB")
home <- sp::SpatialPoints(coords = home, proj4string = crs)
home <- sp::spTransform(... |
get_CAGE_promoters <- function (tc_gr, promoters, keep_all_promoters = FALSE, upstream=500, downstream=500, protein_coding_only=TRUE) {
#' Create promoters centered on dominant TSS CAGE tag clusters with annotations from Biomart promoters.
#'
#' @param tc_gr GenomicRanges object containing tag clusters extracted... | /R/get_CAGE_promoters.R | no_license | Dunjanik/PromoterOntology | R | false | false | 3,172 | r | get_CAGE_promoters <- function (tc_gr, promoters, keep_all_promoters = FALSE, upstream=500, downstream=500, protein_coding_only=TRUE) {
#' Create promoters centered on dominant TSS CAGE tag clusters with annotations from Biomart promoters.
#'
#' @param tc_gr GenomicRanges object containing tag clusters extracted... |
library(tidyverse)
library(gapminder)
gapminder %>% filter(year == 2007) -> gapminder07
gapminder07 %>% ggplot(aes(gdpPercap, lifeExp))
gapminder07 %>% ggplot(aes(gdpPercap, lifeExp)) + geom_point()
gapminder07 %>% ggplot(aes(gdpPercap, lifeExp)) + geom_point() + scale_x_log10()
gapminder07 %>% ggplot(aes(gdpPercap, l... | /day_6_desciriptive stats/example.R | no_license | MarcKissel/QuantMethodsNotes | R | false | false | 1,081 | r | library(tidyverse)
library(gapminder)
gapminder %>% filter(year == 2007) -> gapminder07
gapminder07 %>% ggplot(aes(gdpPercap, lifeExp))
gapminder07 %>% ggplot(aes(gdpPercap, lifeExp)) + geom_point()
gapminder07 %>% ggplot(aes(gdpPercap, lifeExp)) + geom_point() + scale_x_log10()
gapminder07 %>% ggplot(aes(gdpPercap, l... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gurobi_tools.R
\name{flux_coupling_raptor}
\alias{flux_coupling_raptor}
\title{determine flux coupling between reactions in a Gurobi model}
\usage{
flux_coupling_raptor(model, min_fva_cor = 0.9, fix_frac = 0.1,
fix_tol_frac = 0.01, bnd_tol ... | /man/flux_coupling_raptor.Rd | no_license | DikshantPradhan/FluxCouplingTools | R | false | true | 1,505 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gurobi_tools.R
\name{flux_coupling_raptor}
\alias{flux_coupling_raptor}
\title{determine flux coupling between reactions in a Gurobi model}
\usage{
flux_coupling_raptor(model, min_fva_cor = 0.9, fix_frac = 0.1,
fix_tol_frac = 0.01, bnd_tol ... |
#Authur: Maureen Waitherero Wachira
#For:Setting-up-Twitter-R-for-text-analytics
#Date: 8th September 2016
#******************Retrieve tweets from Twitter*****************************
#*************************************************************
library(twitteR)
library(ROAuth)
#******************Twitter authentica... | /Setting-up_Twitter-R-for-text-analytics.R | no_license | maureenwaitherero/Setting-up-Twitter-R-for-text-analytics | R | false | false | 1,112 | r | #Authur: Maureen Waitherero Wachira
#For:Setting-up-Twitter-R-for-text-analytics
#Date: 8th September 2016
#******************Retrieve tweets from Twitter*****************************
#*************************************************************
library(twitteR)
library(ROAuth)
#******************Twitter authentica... |
## This code aims at using cache to avoid potentially time-consuming computations and store in memory
## result of computation that has already been done.
## This code is written based on the model given for mean computation using cache.
## makeCacheMatrix function creates "matrix" object that can cache its inve... | /cachematrix.R | no_license | vbenvenuto/ProgrammingAssignment2 | R | false | false | 1,822 | r | ## This code aims at using cache to avoid potentially time-consuming computations and store in memory
## result of computation that has already been done.
## This code is written based on the model given for mean computation using cache.
## makeCacheMatrix function creates "matrix" object that can cache its inve... |
#' Draw a qtl plot
#'
#' Visualisation of the final set of QTLs selected after the multi-trait GWAS.
#'
#' Each horizontal line contains QTLs of one trait, phenotypic trait or
#' trial. Option: Vertical white lines can indicate chromosome
#' subdivision, genes of interest, known QTLs, etc. Circle diameters are
#... | /statgenGWAS/R/qtlPlot.R | no_license | akhikolla/TestedPackages-NoIssues | R | false | false | 11,203 | r | #' Draw a qtl plot
#'
#' Visualisation of the final set of QTLs selected after the multi-trait GWAS.
#'
#' Each horizontal line contains QTLs of one trait, phenotypic trait or
#' trial. Option: Vertical white lines can indicate chromosome
#' subdivision, genes of interest, known QTLs, etc. Circle diameters are
#... |
# A while loop is useful for repeating until a condition is met
# if depth to groundwater in a well increases by 10% per year, how many years will it take for the water level in the well to be greater than 80 meters, if the current depth to groundwater is 10 meters.
# Set up initial conditions of year = 1 and star... | /assignments/3/R/while_loop.R | no_license | Annika-Leiby/Computing | R | false | false | 651 | r | # A while loop is useful for repeating until a condition is met
# if depth to groundwater in a well increases by 10% per year, how many years will it take for the water level in the well to be greater than 80 meters, if the current depth to groundwater is 10 meters.
# Set up initial conditions of year = 1 and star... |
\name{em_tau}
\alias{em_tau}
\alias{em_tau_safe}
\title{
Compute probabilities for the observations to belong to each of the components
}
\description{
Supporting function for EM algorithm. Update the conditional
probabilities of the components of the MixAR model
(for E-step of EM algorithm).
}
\usage{
em_tau(s... | /man/em_tau.Rd | no_license | yangkedc1984/mixAR | R | false | false | 1,301 | rd | \name{em_tau}
\alias{em_tau}
\alias{em_tau_safe}
\title{
Compute probabilities for the observations to belong to each of the components
}
\description{
Supporting function for EM algorithm. Update the conditional
probabilities of the components of the MixAR model
(for E-step of EM algorithm).
}
\usage{
em_tau(s... |
`plot.segratioMCMC` <-
function(x, ..., row.index=c(1:10),
var.index=c(1:6),
marker.index=c(1:8))
{
if (class(x) != "segratioMCMC")
stop("'x' must be of class 'segratioMCMC'")
## based on plot.mcmc - maybe should look at usemethod
T.in... | /R/plot.segratioMCMC.R | no_license | cran/polySegratioMM | R | false | false | 813 | r | `plot.segratioMCMC` <-
function(x, ..., row.index=c(1:10),
var.index=c(1:6),
marker.index=c(1:8))
{
if (class(x) != "segratioMCMC")
stop("'x' must be of class 'segratioMCMC'")
## based on plot.mcmc - maybe should look at usemethod
T.in... |
#!/usr/bin/env Rscript
# Bhishan Poudel
# Jan 12, 2016
# ref: http://harding.edu/fmccown/r/
setwd("~/Copy/Programming/R/rprograms/plotting/")
# Read values from tab-delimited autos.dat
autos_data <- read.table("data/autos.dat", header=T, sep="\t")
# Start device driver to save output to figure.pdf
postscript(file... | /R/rprograms/plotting/dotChart.r | permissive | bhishanpdl/Programming | R | false | false | 573 | r | #!/usr/bin/env Rscript
# Bhishan Poudel
# Jan 12, 2016
# ref: http://harding.edu/fmccown/r/
setwd("~/Copy/Programming/R/rprograms/plotting/")
# Read values from tab-delimited autos.dat
autos_data <- read.table("data/autos.dat", header=T, sep="\t")
# Start device driver to save output to figure.pdf
postscript(file... |
#1
X = c(10,11,12,14,15,16)
Y = c(22,19,20,21,15,17)
df = data.frame(X,Y)
# X Y
#1 10 22
#2 11 19
#3 12 20
#4 14 21
#5 15 15
#6 16 17
plot(X,Y,xlab="x",ylab="y",xlim=c(0,25),ylim=c(0,25))
#2
mean(X)
#[1] 13
mean(Y)
#[1] 19
#3
Reg <- lm(Y~X)
Reg
#Call:
#lm(formula = Y ~ X)
#Coefficients:
#(Intercept) ... | /uebung8.R | no_license | Sanoj200/dbs5 | R | false | false | 624 | r | #1
X = c(10,11,12,14,15,16)
Y = c(22,19,20,21,15,17)
df = data.frame(X,Y)
# X Y
#1 10 22
#2 11 19
#3 12 20
#4 14 21
#5 15 15
#6 16 17
plot(X,Y,xlab="x",ylab="y",xlim=c(0,25),ylim=c(0,25))
#2
mean(X)
#[1] 13
mean(Y)
#[1] 19
#3
Reg <- lm(Y~X)
Reg
#Call:
#lm(formula = Y ~ X)
#Coefficients:
#(Intercept) ... |
library(shiny)
server <- function(input, output) {
.theme<- theme(
axis.line = element_line(colour = 'gray', size = .75),
panel.background = element_blank(),
plot.background = element_blank()
)
output$date_range<- renderText({
dates = format(as.Date(input$dates), "%A, %d-%b. %Y")
... | /server.R | no_license | tstodd93/MTA-PCA-Analysis | R | false | false | 2,883 | r | library(shiny)
server <- function(input, output) {
.theme<- theme(
axis.line = element_line(colour = 'gray', size = .75),
panel.background = element_blank(),
plot.background = element_blank()
)
output$date_range<- renderText({
dates = format(as.Date(input$dates), "%A, %d-%b. %Y")
... |
#########################################################
## C1.gauss: here assumption: gaussian distribution ###
#########################################################
setClass(
Class = "C1.gauss",
contains = "ADEg.C1"
)
setMethod(
f = "initialize",
signature = "C1.gauss",
definition = function(.Obje... | /adegraphics/R/C1.gauss.R | no_license | ingted/R-Examples | R | false | false | 9,623 | r | #########################################################
## C1.gauss: here assumption: gaussian distribution ###
#########################################################
setClass(
Class = "C1.gauss",
contains = "ADEg.C1"
)
setMethod(
f = "initialize",
signature = "C1.gauss",
definition = function(.Obje... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/codestarconnections_operations.R
\name{codestarconnections_list_hosts}
\alias{codestarconnections_list_hosts}
\title{Lists the hosts associated with your account}
\usage{
codestarconnections_list_hosts(MaxResults = NULL, NextToken = NULL)
}
\... | /cran/paws.developer.tools/man/codestarconnections_list_hosts.Rd | permissive | paws-r/paws | R | false | true | 877 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/codestarconnections_operations.R
\name{codestarconnections_list_hosts}
\alias{codestarconnections_list_hosts}
\title{Lists the hosts associated with your account}
\usage{
codestarconnections_list_hosts(MaxResults = NULL, NextToken = NULL)
}
\... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/RhtslibTest.R
\docType{package}
\name{RhtslibTest}
\alias{RhtslibTest}
\alias{RhtslibTest-package}
\title{RhtslibTest: Testing link to Rhtslib.}
\description{
Testing link to Rhtslib.
}
| /man/RhtslibTest.Rd | no_license | lucasnell/RhtslibTest | R | false | true | 264 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/RhtslibTest.R
\docType{package}
\name{RhtslibTest}
\alias{RhtslibTest}
\alias{RhtslibTest-package}
\title{RhtslibTest: Testing link to Rhtslib.}
\description{
Testing link to Rhtslib.
}
|
#' sweetalert in R as an htmlwidget
#'
#' Create sweetalerts in R with this function. For details on the arguments, see the
#' \href{http://t4t5.github.io/sweetalert/}{SweetAlert demo}.
#'
#' @examples
#' \dontrun{
#' library(sweetalertR)
#' library(htmltools)
#'
#'
#' # do the first sweetalert example using a tagList... | /R/sweetalert.R | permissive | timelyportfolio/sweetalertR | R | false | false | 3,324 | r | #' sweetalert in R as an htmlwidget
#'
#' Create sweetalerts in R with this function. For details on the arguments, see the
#' \href{http://t4t5.github.io/sweetalert/}{SweetAlert demo}.
#'
#' @examples
#' \dontrun{
#' library(sweetalertR)
#' library(htmltools)
#'
#'
#' # do the first sweetalert example using a tagList... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/PSI_mu_fourier.R
\name{PSI_mu_fourier}
\alias{PSI_mu_fourier}
\title{Auxiliary funciton for the evaluation of the SVD of F_c on a pre-specified grid divided by the singular values to the square.}
\usage{
PSI_mu_fourier(x, c, b, Psi, res... | /man/PSI_mu_fourier.Rd | no_license | cran/RandomCoefficients | R | false | true | 1,347 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/PSI_mu_fourier.R
\name{PSI_mu_fourier}
\alias{PSI_mu_fourier}
\title{Auxiliary funciton for the evaluation of the SVD of F_c on a pre-specified grid divided by the singular values to the square.}
\usage{
PSI_mu_fourier(x, c, b, Psi, res... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/distance_manifold.R
\name{distance_manifold}
\alias{distance_manifold}
\title{Distance on the manifold}
\usage{
distance_manifold(data1, data2, metric_manifold = "Frobenius")
}
\arguments{
\item{data1}{Either a list/array [\code{p,p,B1}] of \... | /man/distance_manifold.Rd | no_license | chencaf/KrigingManifoldData | R | false | true | 1,445 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/distance_manifold.R
\name{distance_manifold}
\alias{distance_manifold}
\title{Distance on the manifold}
\usage{
distance_manifold(data1, data2, metric_manifold = "Frobenius")
}
\arguments{
\item{data1}{Either a list/array [\code{p,p,B1}] of \... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/slim_lang.R
\name{addMutations}
\alias{addMutations}
\alias{Genome$addMutations}
\alias{.G$addMutations}
\title{SLiM method addMutations}
\usage{
addMutations(mutations)
}
\arguments{
\item{mutations}{An object of type Mutation object. See de... | /man/addMutations.Rd | permissive | rdinnager/slimr | R | false | true | 2,965 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/slim_lang.R
\name{addMutations}
\alias{addMutations}
\alias{Genome$addMutations}
\alias{.G$addMutations}
\title{SLiM method addMutations}
\usage{
addMutations(mutations)
}
\arguments{
\item{mutations}{An object of type Mutation object. See de... |
vector <- 1:1000
sum(vector[vector%%3==0 | vector%%5==0])
| /Problem001/R/solution_1.R | permissive | DestructHub/ProjectEuler | R | false | false | 59 | r | vector <- 1:1000
sum(vector[vector%%3==0 | vector%%5==0])
|
library(TBEST)
### Name: plot.best
### Title: Plot a dendrogam of a hierarchical cluster with branches labeled
### by their numbers and significance estimates of tightness.
### Aliases: plot.best plot
### ** Examples
## Not run:
##D data(leukemia)
##D mytable<-SigTree(data.matrix(leukemia),mystat="all",
##D ... | /data/genthat_extracted_code/TBEST/examples/plot.best.Rd.R | no_license | surayaaramli/typeRrh | R | false | false | 1,214 | r | library(TBEST)
### Name: plot.best
### Title: Plot a dendrogam of a hierarchical cluster with branches labeled
### by their numbers and significance estimates of tightness.
### Aliases: plot.best plot
### ** Examples
## Not run:
##D data(leukemia)
##D mytable<-SigTree(data.matrix(leukemia),mystat="all",
##D ... |
\name{WeightedROC}
\alias{WeightedROC}
\title{WeightedROC}
\description{Compute a weighted ROC curve.}
\usage{WeightedROC(guess, label, weight = rep(1, length(label)))}
\arguments{
\item{guess}{Numeric vector of scores.}
\item{label}{True positive/negative labels. A factor with 2 unique values, or
integer/n... | /man/WeightedROC.Rd | no_license | minghao2016/WeightedROC | R | false | false | 4,502 | rd | \name{WeightedROC}
\alias{WeightedROC}
\title{WeightedROC}
\description{Compute a weighted ROC curve.}
\usage{WeightedROC(guess, label, weight = rep(1, length(label)))}
\arguments{
\item{guess}{Numeric vector of scores.}
\item{label}{True positive/negative labels. A factor with 2 unique values, or
integer/n... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/zchunk_L102.water.supply.unlimited.R
\name{module_water_L102.water.supply.unlimited}
\alias{module_water_L102.water.supply.unlimited}
\title{module_water_L102.water.supply.unlimited}
\usage{
module_water_L102.water.supply.unlimited(command, .... | /input/gcamdata/man/module_water_L102.water.supply.unlimited.Rd | permissive | ashiklom/gcam-core | R | false | true | 998 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/zchunk_L102.water.supply.unlimited.R
\name{module_water_L102.water.supply.unlimited}
\alias{module_water_L102.water.supply.unlimited}
\title{module_water_L102.water.supply.unlimited}
\usage{
module_water_L102.water.supply.unlimited(command, .... |
#' population data.
#'
#' Contains population data example
#' source: jateng.bps.go.id
#'
#' @format A data frame with one variables: \code{Populasi}
"population"
#' distance data.
#'
#' Contains distance matrix all region in Central Java
#' Data take from Central Java shapefile
#' source: bps.go.id
#'
"... | /R/data.R | no_license | cran/spatialClust | R | false | false | 662 | r | #' population data.
#'
#' Contains population data example
#' source: jateng.bps.go.id
#'
#' @format A data frame with one variables: \code{Populasi}
"population"
#' distance data.
#'
#' Contains distance matrix all region in Central Java
#' Data take from Central Java shapefile
#' source: bps.go.id
#'
"... |
#' Construction multiple knockoff matrices
#'
#' This function generates a specified number of knockoff matrices given the data
#' and a knockoff sampling function.
#'
#' @param X n x p matrix or data frame of original variables.
#' @param K number of knockoff matrices.
#' @param knockoffs function for the knockoff con... | /R/multiknockfilter.R | no_license | cKarypidis/multiknockoffs | R | false | false | 6,441 | r | #' Construction multiple knockoff matrices
#'
#' This function generates a specified number of knockoff matrices given the data
#' and a knockoff sampling function.
#'
#' @param X n x p matrix or data frame of original variables.
#' @param K number of knockoff matrices.
#' @param knockoffs function for the knockoff con... |
# R Tutorial 1.10
# Logic Statements and a Few Other Random But Useful Commands in R
Age[1:5]
temp <- Age>15
temp[1:5]
temp2 <- as.numeric(Age>15)
temp2[1:5]
LungCapData[1:5,]
FemSmoke <- Gender=="female" & Smoke=="yes"
FemSmoke[1:5]
MoreData <- cbind(LungCapData, FemSmoke)
MoreData[1:5,]
rm(list=ls())
| /Tutorial 1_10.R | no_license | rallaking/Rstudio | R | false | false | 306 | r | # R Tutorial 1.10
# Logic Statements and a Few Other Random But Useful Commands in R
Age[1:5]
temp <- Age>15
temp[1:5]
temp2 <- as.numeric(Age>15)
temp2[1:5]
LungCapData[1:5,]
FemSmoke <- Gender=="female" & Smoke=="yes"
FemSmoke[1:5]
MoreData <- cbind(LungCapData, FemSmoke)
MoreData[1:5,]
rm(list=ls())
|
library(testthat)
context("checks new plant quadrat data")
data <- read.csv("../Plants/Portal_plant_quadrats.csv")
species <- read.csv('../Plants/Portal_plant_species.csv')
test_that("valid year", {
expect_true(all(data$year %in% 1981:max(data$year)))
})
test_that("valid season", {
expect_true(all(data$se... | /testthat/test-plant_quadrats.R | permissive | beecycles/PortalData | R | false | false | 923 | r | library(testthat)
context("checks new plant quadrat data")
data <- read.csv("../Plants/Portal_plant_quadrats.csv")
species <- read.csv('../Plants/Portal_plant_species.csv')
test_that("valid year", {
expect_true(all(data$year %in% 1981:max(data$year)))
})
test_that("valid season", {
expect_true(all(data$se... |
rankhospital <- function(state, outcome, num = "best") {
## Read csv data file
myData <- read.csv("outcome-of-care-measures.csv", na.strings = "Not Available", stringsAsFactors = FALSE)
## Read outcome data
## Check that state and outcome are valid
if(outcome == "heart attack") {
cind <- 11
}
... | /rankhospital.R | no_license | pulkit512/ProgrammingAssignment3 | R | false | false | 1,180 | r |
rankhospital <- function(state, outcome, num = "best") {
## Read csv data file
myData <- read.csv("outcome-of-care-measures.csv", na.strings = "Not Available", stringsAsFactors = FALSE)
## Read outcome data
## Check that state and outcome are valid
if(outcome == "heart attack") {
cind <- 11
}
... |
a <- c("that guy is cool",
"what a wierd mane",
"man, that's a cool",
"that's a cool guyt",
"interesting that this guy's guitar is orange",
"congressman jones",
"chairman jones")
a.df <- as.data.frame(a)
colnames(a.df) <- c("all")
a.df$men <- ifelse(grepl("\\b(guy'?s?'?|spokesm[ae]n'?|chairm[ae]n'?|congres... | /test-grepl.R | no_license | arg2211/NYTtextanalysis | R | false | false | 702 | r | a <- c("that guy is cool",
"what a wierd mane",
"man, that's a cool",
"that's a cool guyt",
"interesting that this guy's guitar is orange",
"congressman jones",
"chairman jones")
a.df <- as.data.frame(a)
colnames(a.df) <- c("all")
a.df$men <- ifelse(grepl("\\b(guy'?s?'?|spokesm[ae]n'?|chairm[ae]n'?|congres... |
\name{Zapsmall}
\alias{Zapsmall}
\alias{Zapsmall.default}
\alias{Zapsmall.data.frame}
\title{Zapsmall Data Frame Columns and Numeric Vectors}
\description{
Put to zero values "close" to zero.
}
\usage{
\method{Zapsmall}{default}(x, digits = getOption("digits"), ...)
\method{Zapsmall}{data.frame}(x, digits = getOption("... | /man/Zapsmall.Rd | no_license | PedroJMA/ReGenesees | R | false | false | 1,511 | rd | \name{Zapsmall}
\alias{Zapsmall}
\alias{Zapsmall.default}
\alias{Zapsmall.data.frame}
\title{Zapsmall Data Frame Columns and Numeric Vectors}
\description{
Put to zero values "close" to zero.
}
\usage{
\method{Zapsmall}{default}(x, digits = getOption("digits"), ...)
\method{Zapsmall}{data.frame}(x, digits = getOption("... |
# Matern 自相关函数族
matern <- function(u, phi, kappa) {
uphi <- u / phi
uphi <- ifelse(u > 0, (((2^(-(kappa - 1))) / ifelse(0, Inf, gamma(kappa))) * (uphi^kappa) * besselK(x = uphi, nu = kappa)), 1)
# uphi[u > 600 * phi] <- 0
return(uphi)
}
library(tikzDevice)
tf <- file.path(getwd(), "figures/matern.tex")
tikz(tf... | /code/02-matern-bessel-function.R | permissive | ahualian/Thesis-Template-Bookdown | R | false | false | 7,289 | r | # Matern 自相关函数族
matern <- function(u, phi, kappa) {
uphi <- u / phi
uphi <- ifelse(u > 0, (((2^(-(kappa - 1))) / ifelse(0, Inf, gamma(kappa))) * (uphi^kappa) * besselK(x = uphi, nu = kappa)), 1)
# uphi[u > 600 * phi] <- 0
return(uphi)
}
library(tikzDevice)
tf <- file.path(getwd(), "figures/matern.tex")
tikz(tf... |
library(shiny)
library(HistData)
data(GaltonFamilies)
library(dplyr)
library(ggplot2)
# 1st step: pass inches to cm
gf <- GaltonFamilies
gf <- gf %>% mutate(father=father*2.54,
mother=mother*2.54,
childHeight=childHeight*2.54)
# linear model
model1 <- lm(childHeigh... | /CourseProject_DevelopingDataProducts.R | no_license | sheney02/Developing-Data-Products | R | false | false | 2,848 | r | library(shiny)
library(HistData)
data(GaltonFamilies)
library(dplyr)
library(ggplot2)
# 1st step: pass inches to cm
gf <- GaltonFamilies
gf <- gf %>% mutate(father=father*2.54,
mother=mother*2.54,
childHeight=childHeight*2.54)
# linear model
model1 <- lm(childHeigh... |
### title: plot1.R
#
# purpose: make plot for Module 4 (Exploratory Data Analysis),
# Week 1, Course Project 1 for coursera's data science specialization
#
# input: electric power consumption data set
# https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip
#
# description of file is... | /plot1.R | no_license | chenerous/ExData_Plotting1 | R | false | false | 1,305 | r | ### title: plot1.R
#
# purpose: make plot for Module 4 (Exploratory Data Analysis),
# Week 1, Course Project 1 for coursera's data science specialization
#
# input: electric power consumption data set
# https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip
#
# description of file is... |
d<-read.table("../Data/SparrowSize.txt", header=TRUE)
plot(d$Mass~d$Tarsus, ylab="Mass (g)", xlab="Tarsus (mm)", pch=19, cex=0.4)
d1<-subset(d, d$Mass!="NA")
d2<-subset(d1, d1$Tarsus!="NA")
length(d2$Tarsus)
model1<-lm(Mass~Tarsus, data=d2)
summary(model1)
model1
hist(model1$residuals)
head(model1$residuals)
x<-c... | /Week4/Code/HO10.R | no_license | SamT123/CMEECoursework | R | false | false | 729 | r | d<-read.table("../Data/SparrowSize.txt", header=TRUE)
plot(d$Mass~d$Tarsus, ylab="Mass (g)", xlab="Tarsus (mm)", pch=19, cex=0.4)
d1<-subset(d, d$Mass!="NA")
d2<-subset(d1, d1$Tarsus!="NA")
length(d2$Tarsus)
model1<-lm(Mass~Tarsus, data=d2)
summary(model1)
model1
hist(model1$residuals)
head(model1$residuals)
x<-c... |
# Ejemplo 2. Matrices
# Objetivo
# Crear nuevas matrices
# Extraer datos dentro de una matriz
# Calcular sus dimensiones
# Realizar operaciones básicas entre matrices
# Requisitos
# Tener instalados R y RStudio
# Haber estudiado el Prework
# Desarrollo
# Se debe seguir el código propuesto y tratar... | /Sesion-01/Ejemplo-02/Ejemplo_02.R | no_license | itzamango/Programacion-R-Santander-2021 | R | false | false | 1,270 | r | # Ejemplo 2. Matrices
# Objetivo
# Crear nuevas matrices
# Extraer datos dentro de una matriz
# Calcular sus dimensiones
# Realizar operaciones básicas entre matrices
# Requisitos
# Tener instalados R y RStudio
# Haber estudiado el Prework
# Desarrollo
# Se debe seguir el código propuesto y tratar... |
#
# 實例ch11_6.R
#
ch11_6 <- function( x ) x * x | /R語言邁向Big Data之路程式範例/ch11/ch11_6.R | no_license | jtlai0921/XB1701- | R | false | false | 51 | r | #
# 實例ch11_6.R
#
ch11_6 <- function( x ) x * x |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.