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 |
|---|---|---|---|---|---|---|---|---|---|
## File Location
fileurl<- "https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip"
## Download file to a temporary location, read in dataframe, and delete tempfile
temp<-tempfile()
download.file(fileurl, temp)
filename<-unzip(temp, list=TRUE)[[1]]
message("Reading in data frame... ple... | /CP1/plot4.R | no_license | lachrymator/ExpDataAnalysis | R | false | false | 1,493 | r | ## File Location
fileurl<- "https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip"
## Download file to a temporary location, read in dataframe, and delete tempfile
temp<-tempfile()
download.file(fileurl, temp)
filename<-unzip(temp, list=TRUE)[[1]]
message("Reading in data frame... ple... |
#P(t | l) = P(l | t) P(t)
dt <- function(t, l, n, b){
f <- function(tc)dtl(tc, l) * d_mutant_age2(t-tc, n, b)
integrate(f, 0, t-1e-14)$value
}
dtl <- function(t, l) pt(t) * plt(t, l) / pl(l)
pt <- function(t) dexp(t, 1)
plt <- function(t, l) dexp(l * 1e-4, t)
pl <- function(l){
f <- function(t)pt(t) * plt... | /scripts/age.R | no_license | BenjaminPeter/hapage | R | false | false | 2,237 | r |
#P(t | l) = P(l | t) P(t)
dt <- function(t, l, n, b){
f <- function(tc)dtl(tc, l) * d_mutant_age2(t-tc, n, b)
integrate(f, 0, t-1e-14)$value
}
dtl <- function(t, l) pt(t) * plt(t, l) / pl(l)
pt <- function(t) dexp(t, 1)
plt <- function(t, l) dexp(l * 1e-4, t)
pl <- function(l){
f <- function(t)pt(t) * plt... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mcnemar-test.R
\name{mcnemar_test}
\alias{mcnemar_test}
\title{McNemar Test}
\usage{
mcnemar_test(x, y = NULL)
}
\arguments{
\item{x}{2 x 2 matrix or 2 x 2 table or numeric variable or factor variable}
\item{y}{numeric or factor variable}
}
... | /man/mcnemar_test.Rd | no_license | sunilkumar87/inferr | R | false | true | 1,619 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mcnemar-test.R
\name{mcnemar_test}
\alias{mcnemar_test}
\title{McNemar Test}
\usage{
mcnemar_test(x, y = NULL)
}
\arguments{
\item{x}{2 x 2 matrix or 2 x 2 table or numeric variable or factor variable}
\item{y}{numeric or factor variable}
}
... |
getwd()
setwd('/home/parikshit/Desktop/R')
install.packages("dplyr")
library(dplyr)
# downloading data
FileLocation <- "https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip"
File <- "UCI HAR Dataset.zip"
if (!file.exists(File)) {
download.file(FileLocation, File, mode = "wb")... | /run_analysis.R | no_license | ParikshitAD/getting-and-cleaning-data-course-project | R | false | false | 3,246 | r | getwd()
setwd('/home/parikshit/Desktop/R')
install.packages("dplyr")
library(dplyr)
# downloading data
FileLocation <- "https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip"
File <- "UCI HAR Dataset.zip"
if (!file.exists(File)) {
download.file(FileLocation, File, mode = "wb")... |
#' Convert Lon/Lat to UTM
#'
#' Convert longitude and latitude coordinates to Universal Transverse
#' Mercator coordinates.
#' @param lon
#' Numeric vector of longitudes.
#' @param lat
#' Numeric vector of latitudes, same length as \code{lon}.
#' @param zone
#' Numeric scalar of the UTM zone, default NULL. See d... | /R/latlon2utm.R | no_license | JVAdams/EchoNet2Fish | R | false | false | 1,768 | r | #' Convert Lon/Lat to UTM
#'
#' Convert longitude and latitude coordinates to Universal Transverse
#' Mercator coordinates.
#' @param lon
#' Numeric vector of longitudes.
#' @param lat
#' Numeric vector of latitudes, same length as \code{lon}.
#' @param zone
#' Numeric scalar of the UTM zone, default NULL. See d... |
#!/usr/bin/env Rscript
# Author: David Scott
# Contact: david.scott18@imperial.ac.uk
# Date: October 24 2018
# Description: use of apply function
rm(list=ls()) # clears workspace
# use of *apply functions
# vectorise data for you
## apply: applying the same function to rows/colums of a matrix
## Build a random ma... | /Week3/Code/apply1.R | no_license | davidtscott/CMEECoursework | R | false | false | 560 | r | #!/usr/bin/env Rscript
# Author: David Scott
# Contact: david.scott18@imperial.ac.uk
# Date: October 24 2018
# Description: use of apply function
rm(list=ls()) # clears workspace
# use of *apply functions
# vectorise data for you
## apply: applying the same function to rows/colums of a matrix
## Build a random ma... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/doSimulation.R
\name{doSimulation}
\alias{doSimulation}
\title{Discrete Time Character Simulation}
\usage{
doSimulation(splits, intrinsicFn, extrinsicFn, startingValues, intrinsicValues,
extrinsicValues, timeStep, saveHistory = FALSE, saveR... | /man/doSimulation.Rd | no_license | JakeJing/treevo | R | false | true | 2,313 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/doSimulation.R
\name{doSimulation}
\alias{doSimulation}
\title{Discrete Time Character Simulation}
\usage{
doSimulation(splits, intrinsicFn, extrinsicFn, startingValues, intrinsicValues,
extrinsicValues, timeStep, saveHistory = FALSE, saveR... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ppt_ph_with_methods.R
\name{ph_with}
\alias{ph_with}
\alias{ph_with.character}
\alias{ph_with.numeric}
\alias{ph_with.factor}
\alias{ph_with.logical}
\alias{ph_with.block_list}
\alias{ph_with.unordered_list}
\alias{ph_with.data.frame}
\alias{... | /man/ph_with.Rd | no_license | berthetclement/officer | R | false | true | 8,296 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ppt_ph_with_methods.R
\name{ph_with}
\alias{ph_with}
\alias{ph_with.character}
\alias{ph_with.numeric}
\alias{ph_with.factor}
\alias{ph_with.logical}
\alias{ph_with.block_list}
\alias{ph_with.unordered_list}
\alias{ph_with.data.frame}
\alias{... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{flow_survival_params}
\alias{flow_survival_params}
\title{Flow-survival parameters}
\format{A list of named vectors (B0) for the following reaches:
\describe{
\item{Sac1}{Sacramento River from Freeport to junctio... | /man/flow_survival_params.Rd | no_license | fishsciences/DeltaPassageModel | R | false | true | 736 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{flow_survival_params}
\alias{flow_survival_params}
\title{Flow-survival parameters}
\format{A list of named vectors (B0) for the following reaches:
\describe{
\item{Sac1}{Sacramento River from Freeport to junctio... |
\name{plot.biso}
\alias{plot.biso}
\title{ Plot a biso object}
\description{
Plots the data and the fit a Bayesian monontoic regression function (with optional confidence bands)
}
\usage{
\method{plot}{biso}(x, xnew, cl = TRUE, add = FALSE, color ="red", \dots)
}
\arguments{
\item{x}{ a \code{biso} object}
... | /man/plot.biso.Rd | no_license | cran/bisoreg | R | false | false | 943 | rd | \name{plot.biso}
\alias{plot.biso}
\title{ Plot a biso object}
\description{
Plots the data and the fit a Bayesian monontoic regression function (with optional confidence bands)
}
\usage{
\method{plot}{biso}(x, xnew, cl = TRUE, add = FALSE, color ="red", \dots)
}
\arguments{
\item{x}{ a \code{biso} object}
... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/util.R
\name{addAverages}
\alias{addAverages}
\title{Add averages}
\usage{
addAverages(data_set)
}
\arguments{
\item{data_set}{the data frame to add averages to}
}
\value{
the same data_set with averages added for pitchers, batters, and
leagu... | /matchups/man/addAverages.Rd | no_license | dpmeixner/baseball | R | false | true | 353 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/util.R
\name{addAverages}
\alias{addAverages}
\title{Add averages}
\usage{
addAverages(data_set)
}
\arguments{
\item{data_set}{the data frame to add averages to}
}
\value{
the same data_set with averages added for pitchers, batters, and
leagu... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/whibo_clustering.R
\name{plot_pairs}
\alias{plot_pairs}
\title{Plot WhiBo Cluster Representatives}
\usage{
plot_pairs(model, data)
}
\arguments{
\item{model}{WhiBo Cluster model.}
\item{data}{Data used for clustering (optional).}
... | /man/plot_pairs.Rd | no_license | cran/whiboclustering | R | false | true | 783 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/whibo_clustering.R
\name{plot_pairs}
\alias{plot_pairs}
\title{Plot WhiBo Cluster Representatives}
\usage{
plot_pairs(model, data)
}
\arguments{
\item{model}{WhiBo Cluster model.}
\item{data}{Data used for clustering (optional).}
... |
library(stockassessment)
tol <- sqrt(.Machine$double.eps)
set.seed(298374)
## jacobian <- function(func, x, ...){
## r <- .Call("jacobian",
## function(x)func(x,...),
## x,
## globalenv(),
## 30L,
## 0.1 * 10^floo... | /testmore/jacobian/script.R | no_license | ejosymart/SAM | R | false | false | 4,214 | r | library(stockassessment)
tol <- sqrt(.Machine$double.eps)
set.seed(298374)
## jacobian <- function(func, x, ...){
## r <- .Call("jacobian",
## function(x)func(x,...),
## x,
## globalenv(),
## 30L,
## 0.1 * 10^floo... |
#====================================
# AnomaliaMensual.R
#
# Calcula Anomalias mensuales:
# restamos medias de la climatologia a
# cada tabla de resumen mensual
#====================================
library(dplyr)
# Directorio base
bdir <- "CUENCAS"
Cl_glob <- "GLOBAL/MegaTClimaAnual.RData"
load(Cl_glob) # Cont... | /AnomaliaAnual.R | no_license | juliosergio/BID2012 | R | false | false | 2,222 | r | #====================================
# AnomaliaMensual.R
#
# Calcula Anomalias mensuales:
# restamos medias de la climatologia a
# cada tabla de resumen mensual
#====================================
library(dplyr)
# Directorio base
bdir <- "CUENCAS"
Cl_glob <- "GLOBAL/MegaTClimaAnual.RData"
load(Cl_glob) # Cont... |
#' Adds a dataframe that defines each interaction as true positive, false negative or true negative
#'
#' @param list Network list
#'
#' @return A Network list object with ObsSuccess, a dataframe detailing all the interactions and whether they are True Positives, False Negative or True Negatives
#' @export
#'
SortRespo... | /R/SortResponseCategory.R | no_license | jcdterry/cassandRa | R | false | false | 1,889 | r | #' Adds a dataframe that defines each interaction as true positive, false negative or true negative
#'
#' @param list Network list
#'
#' @return A Network list object with ObsSuccess, a dataframe detailing all the interactions and whether they are True Positives, False Negative or True Negatives
#' @export
#'
SortRespo... |
loginfo('Beginning munge (versionless products)',
logger = logger_module)
prod_info <- get_product_info(network = network,
domain = domain,
status_level = 'munge',
get_statuses = 'ready') %>%
filter(grepl(pattern = '... | /src/usfs/tenderfoot/munge_versionless.R | permissive | MacroSHEDS/data_processing | R | false | false | 2,518 | r |
loginfo('Beginning munge (versionless products)',
logger = logger_module)
prod_info <- get_product_info(network = network,
domain = domain,
status_level = 'munge',
get_statuses = 'ready') %>%
filter(grepl(pattern = '... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Do not modify this file since it was automatically generated from:
%
% Explorer.R
%
% by the Rdoc compiler part of the R.oo package.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\name{getRootPath.Explorer}
\al... | /man/getRootPath.Explorer.Rd | no_license | HenrikBengtsson/aroma.core | R | false | false | 998 | rd | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Do not modify this file since it was automatically generated from:
%
% Explorer.R
%
% by the Rdoc compiler part of the R.oo package.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\name{getRootPath.Explorer}
\al... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AllClasses.R
\docType{class}
\name{SpatialExperiment-class}
\alias{SpatialExperiment-class}
\alias{SpatialExperiment}
\alias{coerce,SingleCellExperiment,SpatialExperiment-method}
\title{The SpatialExperiment class}
\usage{
SpatialExperiment(.... | /man/SpatialExperiment.Rd | no_license | celsomilne/SpatialExperiment | R | false | true | 1,928 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AllClasses.R
\docType{class}
\name{SpatialExperiment-class}
\alias{SpatialExperiment-class}
\alias{SpatialExperiment}
\alias{coerce,SingleCellExperiment,SpatialExperiment-method}
\title{The SpatialExperiment class}
\usage{
SpatialExperiment(.... |
library(tidyverse)
# library()
load("~/Documents/Projects/ESDL_earlyadopter/ESDL/Results/200819_summary_lai.RData")
# run the 07-ecoregions script and merge with results data frame:
df <- left_join(df, df_biomes)
q75 <- df %>% group_by(biome, stat) %>%
filter(feature == "diff") %>%
summarise(q75 = quantile(value... | /select_outliers.R | permissive | yangxhcaf/ESDL | R | false | false | 2,848 | r | library(tidyverse)
# library()
load("~/Documents/Projects/ESDL_earlyadopter/ESDL/Results/200819_summary_lai.RData")
# run the 07-ecoregions script and merge with results data frame:
df <- left_join(df, df_biomes)
q75 <- df %>% group_by(biome, stat) %>%
filter(feature == "diff") %>%
summarise(q75 = quantile(value... |
## ----comment=NA---------------------------------------------------------------
require(moonBook)
data(acs)
mytable(Dx~.,data=acs)
## ----comment=NA---------------------------------------------------------------
str(acs)
## ----comment=NA---------------------------------------------------------------
mytable(acs)
#... | /inst/doc/moonBook.R | no_license | cran/moonBook | R | false | false | 3,585 | r | ## ----comment=NA---------------------------------------------------------------
require(moonBook)
data(acs)
mytable(Dx~.,data=acs)
## ----comment=NA---------------------------------------------------------------
str(acs)
## ----comment=NA---------------------------------------------------------------
mytable(acs)
#... |
testlist <- list(b = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), p1 = c(8.5728629954997e-312, 1.56898424065867e+82, 8.96970809549085e-158, -1.3258495253834e-113, 2.79620616433656e-119, -6.80033518839696e+41, 2.68298522855314e-211, 1444042902784.06, ... | /metacoder/inst/testfiles/intersect_line_rectangle/AFL_intersect_line_rectangle/intersect_line_rectangle_valgrind_files/1615769225-test.R | permissive | akhikolla/updatedatatype-list3 | R | false | false | 727 | r | testlist <- list(b = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), p1 = c(8.5728629954997e-312, 1.56898424065867e+82, 8.96970809549085e-158, -1.3258495253834e-113, 2.79620616433656e-119, -6.80033518839696e+41, 2.68298522855314e-211, 1444042902784.06, ... |
# This file is generated by make.paws. Please do not edit here.
#' @importFrom paws.common populate
#' @include sns_service.R
NULL
.sns$add_permission_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(TopicArn = structure(logical(0), tags = list(type = "string")), Label ... | /cran/paws.application.integration/R/sns_interfaces.R | permissive | paws-r/paws | R | false | false | 29,340 | r | # This file is generated by make.paws. Please do not edit here.
#' @importFrom paws.common populate
#' @include sns_service.R
NULL
.sns$add_permission_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(TopicArn = structure(logical(0), tags = list(type = "string")), Label ... |
library(tidyverse)
library(lubridate)
all_files<-list.files("Data/Processed/filteredData",full.names = TRUE)
first_list<-list()
for (i in 1:length(all_files)){
print(i)
temp<-readRDS(all_files[i])
temp$LATITUDE<-as.numeric(temp$LATITUDE)
temp$LONGITUDE<-as.numeric(temp$LONGITUDE)
temp$OBSERVATION.DATE<-as.c... | /R/Knitandfilter_ebird.R | no_license | Josh-Lee1/eBird-Fire-Index | R | false | false | 2,231 | r | library(tidyverse)
library(lubridate)
all_files<-list.files("Data/Processed/filteredData",full.names = TRUE)
first_list<-list()
for (i in 1:length(all_files)){
print(i)
temp<-readRDS(all_files[i])
temp$LATITUDE<-as.numeric(temp$LATITUDE)
temp$LONGITUDE<-as.numeric(temp$LONGITUDE)
temp$OBSERVATION.DATE<-as.c... |
#' add_axes
#'
#' Adds axes to the internal region of an OSM plot.
#'
#' @param map A ggplot2 object to which the axes are to be added
#' @param colour Colour of axis (determines colour of all elements: lines,
#' ticks, and labels)
#' @param pos Positions of axes and labels relative to entire plot device
#' @param alph... | /R/add-axes.R | no_license | jeperez/osmplotr | R | false | false | 6,367 | r | #' add_axes
#'
#' Adds axes to the internal region of an OSM plot.
#'
#' @param map A ggplot2 object to which the axes are to be added
#' @param colour Colour of axis (determines colour of all elements: lines,
#' ticks, and labels)
#' @param pos Positions of axes and labels relative to entire plot device
#' @param alph... |
#FigS2F
#single_tails_minus_compile.R
library(ggplot2)
library(reshape2)
library(plyr)
binwidth = 1
bin_vector<-function(v,n){unname(tapply(v, (seq_along(v)-1) %/% n, sum))} #note that the 51st bin is the 251st tail length, it is excluded
source("ggplot_theme.R")
library(ggplot2)
library(reshape2)
library(plyr)
s... | /KinetTlnFigures/FigS2FmRNA.R | no_license | timeisen/DynamicsOfCytoplasmicMrnaMetabolism | R | false | false | 3,467 | r | #FigS2F
#single_tails_minus_compile.R
library(ggplot2)
library(reshape2)
library(plyr)
binwidth = 1
bin_vector<-function(v,n){unname(tapply(v, (seq_along(v)-1) %/% n, sum))} #note that the 51st bin is the 251st tail length, it is excluded
source("ggplot_theme.R")
library(ggplot2)
library(reshape2)
library(plyr)
s... |
## surveys <- read.csv(file="data/surveys.csv")
args(read.csv)
## read.csv(file="data/surveys.csv", header=TRUE) # is identical to:
## read.csv("data/surveys.csv", TRUE)
## read.csv(file="data/surveys.csv", header=TRUE) # is identical to:
## read.csv(header=TRUE, file="data/surveys.csv")
## ?barplot
## args(lm)
## ??ge... | /skeleton-lessons.R | permissive | karthik/R-ecology | R | false | false | 3,643 | r | ## surveys <- read.csv(file="data/surveys.csv")
args(read.csv)
## read.csv(file="data/surveys.csv", header=TRUE) # is identical to:
## read.csv("data/surveys.csv", TRUE)
## read.csv(file="data/surveys.csv", header=TRUE) # is identical to:
## read.csv(header=TRUE, file="data/surveys.csv")
## ?barplot
## args(lm)
## ??ge... |
# Exercise 1: practice with basic R syntax
# Create a variable `hometown` that stores the city in which you were born
hometown <- 'Hangzhou'
# Assign your name to the variable `my_name`
my_name <- 'Sihan'
# Assign your height (in inches) to a variable `my_height`
my_height <- 5.7
# Create a variable `puppies` equal... | /chapter-05-exercises/exercise-1/exercise.R | permissive | sihanlu2013/book-exercises | R | false | false | 824 | r | # Exercise 1: practice with basic R syntax
# Create a variable `hometown` that stores the city in which you were born
hometown <- 'Hangzhou'
# Assign your name to the variable `my_name`
my_name <- 'Sihan'
# Assign your height (in inches) to a variable `my_height`
my_height <- 5.7
# Create a variable `puppies` equal... |
rhessysver = "/PATH/rhessys7.0"
setwd("/PATH/scripts")
# Load these libraries
library(pse)
library(tidyverse)
library(RHESSysIOinR)
library(RHESSysPreprocessing)
library(lubridate)
# define a function - nse
NSE = function (m, o)
{
err = m - o
meanobs = mean(o)
mse = sum(err*err)
ovar = sum((o-meanobs)*(o-me... | /SnowDrought/scripts/cal_in_R.R | no_license | LouisGraup/SnowDrought | R | false | false | 7,131 | r | rhessysver = "/PATH/rhessys7.0"
setwd("/PATH/scripts")
# Load these libraries
library(pse)
library(tidyverse)
library(RHESSysIOinR)
library(RHESSysPreprocessing)
library(lubridate)
# define a function - nse
NSE = function (m, o)
{
err = m - o
meanobs = mean(o)
mse = sum(err*err)
ovar = sum((o-meanobs)*(o-me... |
## Given below are two functions that cache and compute the
## inverse of a matrix.
## This function creates a special "matrix" object
## that can cache its inverse.
makeCacheMatrix <- function(mtx = matrix()) {
inverse <- NULL
set <- function(x) {
mtx <<- x;
inverse <<- NULL;
}
get <... | /cachematrix.R | no_license | shaunakgupte1/datasharing | R | false | false | 1,022 | r | ## Given below are two functions that cache and compute the
## inverse of a matrix.
## This function creates a special "matrix" object
## that can cache its inverse.
makeCacheMatrix <- function(mtx = matrix()) {
inverse <- NULL
set <- function(x) {
mtx <<- x;
inverse <<- NULL;
}
get <... |
hiv.mortmod <-
function(e0 = NULL, child.mort = NULL, adult.mort = NULL, prev = NULL,
child.art = NULL, adult.art = NULL, model = 1, region = 1,
sex = 1, lt = FALSE, opt = TRUE, recal = NULL){
#data(HIV-MLTs-obs)
# e0
if(model==1){
mx.out <- mortmod.e0(e0 = e0, prev = prev, child.art = child.art,... | /R/hiv.mortmod.R | no_license | PPgp/HIV.LifeTables | R | false | false | 2,933 | r | hiv.mortmod <-
function(e0 = NULL, child.mort = NULL, adult.mort = NULL, prev = NULL,
child.art = NULL, adult.art = NULL, model = 1, region = 1,
sex = 1, lt = FALSE, opt = TRUE, recal = NULL){
#data(HIV-MLTs-obs)
# e0
if(model==1){
mx.out <- mortmod.e0(e0 = e0, prev = prev, child.art = child.art,... |
source('~/NBS-DS/R/impala/package.R')
options(error=traceback)
options(warn=1)
# Performance tests for R+impala query transformation library
# Select statement for all data for artists below some id on the time range 2014-01-01 to 2014-05-26
query_format = 'SELECT * FROM idx_entity WHERE entity_id < %s and unix_secon... | /demonstrative/R/impala/transforms_ptest.R | no_license | eric-czech/portfolio | R | false | false | 1,053 | r | source('~/NBS-DS/R/impala/package.R')
options(error=traceback)
options(warn=1)
# Performance tests for R+impala query transformation library
# Select statement for all data for artists below some id on the time range 2014-01-01 to 2014-05-26
query_format = 'SELECT * FROM idx_entity WHERE entity_id < %s and unix_secon... |
library (igraph)
library (ggplot2)
time1 <- c()
time2 <- c()
time3 <- c()
vertex_col <- function(add_df, graph_df) {
add_df_1 <- add_df
for (i in 1:nrow(add_df)) {
if (add_df[i,3] == "SP") {
for (j in 1:nrow(graph_df)) {
if (graph_df[j,1] == add_df[i,1]) {
for (k in 1:nrow... | /Lesson 5/density.R | no_license | itaguas/Modelizaci-n | R | false | false | 6,158 | r | library (igraph)
library (ggplot2)
time1 <- c()
time2 <- c()
time3 <- c()
vertex_col <- function(add_df, graph_df) {
add_df_1 <- add_df
for (i in 1:nrow(add_df)) {
if (add_df[i,3] == "SP") {
for (j in 1:nrow(graph_df)) {
if (graph_df[j,1] == add_df[i,1]) {
for (k in 1:nrow... |
# Exercise 6: dplyr join operations
# Install the `"nycflights13"` package. Load (`library()`) the package.
# You'll also need to load `dplyr`
#install.packages("nycflights13") # should be done already
library("nycflights13")
library("dplyr")
# Create a dataframe of the average arrival delays for each _desti... | /chapter-11-exercises/exercise-6/exercise.R | permissive | k1997fh/book-exercises | R | false | false | 841 | r | # Exercise 6: dplyr join operations
# Install the `"nycflights13"` package. Load (`library()`) the package.
# You'll also need to load `dplyr`
#install.packages("nycflights13") # should be done already
library("nycflights13")
library("dplyr")
# Create a dataframe of the average arrival delays for each _desti... |
#' Format a string
#' @name str_format
#' @title format a string like python
#'
#' @param str A string
#' @param ... See details
#' @return A string or a string vector
#'
#' @references \url{https://docs.python.org/3/library/stdtypes.html#str.format}
#' \url{https://github.com/nicolewhite/pystr/blob/master/R/pystr_for... | /R/py_format.R | no_license | evanwang1990/stringr | R | false | false | 1,576 | r | #' Format a string
#' @name str_format
#' @title format a string like python
#'
#' @param str A string
#' @param ... See details
#' @return A string or a string vector
#'
#' @references \url{https://docs.python.org/3/library/stdtypes.html#str.format}
#' \url{https://github.com/nicolewhite/pystr/blob/master/R/pystr_for... |
testlist <- list(doy = c(4.62595082430429e-312, 3.64097969159734e-277, -0.427429395729092, 2.09887675795476e-104, 1.55322770574539e-47, 1.45474215376015e+135, 3.56441595774554e+114, -2.64525441665141e+303, -9.52682579807939e+139, -3.98397415900396e+183, -1.77863325536183e+126, 6.42851301544252e-310, 1.6601383076532... | /meteor/inst/testfiles/Photoperiod/AFL_Photoperiod/Photoperiod_valgrind_files/1615769492-test.R | no_license | akhikolla/updatedatatype-list3 | R | false | false | 683 | r | testlist <- list(doy = c(4.62595082430429e-312, 3.64097969159734e-277, -0.427429395729092, 2.09887675795476e-104, 1.55322770574539e-47, 1.45474215376015e+135, 3.56441595774554e+114, -2.64525441665141e+303, -9.52682579807939e+139, -3.98397415900396e+183, -1.77863325536183e+126, 6.42851301544252e-310, 1.6601383076532... |
#********************************* 277 Yelp Social Network Analysis ***************************************************
#Filename: Yelp_extraction.R
#Date: January 2021
#Author: Team1A
#***************************************************************************************************
library(jsonlite)
library(tidy... | /Yelp_data_extraction.R | no_license | chengwuw/Yelp-Social-Network-Analysis | R | false | false | 2,826 | r |
#********************************* 277 Yelp Social Network Analysis ***************************************************
#Filename: Yelp_extraction.R
#Date: January 2021
#Author: Team1A
#***************************************************************************************************
library(jsonlite)
library(tidy... |
# load 10 lines of data
data <- read.table("data/household_power_consumption.txt",
header = TRUE,
sep = ";",
nrows = 10,
na.strings = '?')
# get column classes
colClasses <- sapply(data, class)
# read data
data <- read.table("data/household_p... | /plot2.R | no_license | martjanz/ExData_Plotting1 | R | false | false | 1,114 | r | # load 10 lines of data
data <- read.table("data/household_power_consumption.txt",
header = TRUE,
sep = ";",
nrows = 10,
na.strings = '?')
# get column classes
colClasses <- sapply(data, class)
# read data
data <- read.table("data/household_p... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/GMLMultiSurface.R
\docType{class}
\name{GMLMultiSurface}
\alias{GMLMultiSurface}
\title{GMLMultiSurface}
\format{
\code{\link{R6Class}} object.
}
\value{
Object of \code{\link{R6Class}} for modelling an GML multisurface
}
\descrip... | /man/GMLMultiSurface.Rd | no_license | cran/geometa | R | false | true | 12,531 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/GMLMultiSurface.R
\docType{class}
\name{GMLMultiSurface}
\alias{GMLMultiSurface}
\title{GMLMultiSurface}
\format{
\code{\link{R6Class}} object.
}
\value{
Object of \code{\link{R6Class}} for modelling an GML multisurface
}
\descrip... |
#Missing Values - Visualisation
library(VIM)
#Visualisation
VIM::aggr(sleep, prop=F, numbers=T) #Total nos
#NonD max NA values
VIM::aggr(sleep, prop=T) # Proportion
VIM::matrixplot(sleep) # rowno and missing values in red
#The continuous variable is rescaled and represented by grayscale colors. Lighter colors ind... | /23-functions/61c-missing2.R | no_license | DUanalytics/rAnalytics | R | false | false | 1,430 | r | #Missing Values - Visualisation
library(VIM)
#Visualisation
VIM::aggr(sleep, prop=F, numbers=T) #Total nos
#NonD max NA values
VIM::aggr(sleep, prop=T) # Proportion
VIM::matrixplot(sleep) # rowno and missing values in red
#The continuous variable is rescaled and represented by grayscale colors. Lighter colors ind... |
#' Set the number of decimal places
#' x = numeric
#' k = integer
set_decimal <- function(x, k, cut = 200 ){
if( !is.null(x) && length(x)> 0 ){
if( x[ 1 ]< cut ){
format(round(x, k), nsmall=k,big.mark=",")
}else {
format(round(x, 0), nsmall=0,big.mark=",")
}
}
}
#' General object view... | /R/beama_utils.R | no_license | eamoakohene/beamaUtils | R | false | false | 17,163 | r | #' Set the number of decimal places
#' x = numeric
#' k = integer
set_decimal <- function(x, k, cut = 200 ){
if( !is.null(x) && length(x)> 0 ){
if( x[ 1 ]< cut ){
format(round(x, k), nsmall=k,big.mark=",")
}else {
format(round(x, 0), nsmall=0,big.mark=",")
}
}
}
#' General object view... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lexical_classification.R
\name{print.cumulative_lexical_classification}
\alias{print.cumulative_lexical_classification}
\title{Prints a cumulative_lexical_classification Object}
\usage{
\method{print}{cumulative_lexical_classification}(x, ...... | /man/print.cumulative_lexical_classification.Rd | no_license | cran/qdap | R | false | true | 486 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lexical_classification.R
\name{print.cumulative_lexical_classification}
\alias{print.cumulative_lexical_classification}
\title{Prints a cumulative_lexical_classification Object}
\usage{
\method{print}{cumulative_lexical_classification}(x, ...... |
#' Implements simple linear regression by hand
#'
#' @param dat A data frame
#' @param response The name of a response variable in the data frame (unquoted)
#' @param explanatory The name of the explanatory variable in the data frame (unquoted)
#'
#' @return A data frame of coefficients
#'
#' @import dplyr
#'
#' @expor... | /R/linear_regression.R | permissive | shanealman/regress431 | R | false | false | 1,500 | r | #' Implements simple linear regression by hand
#'
#' @param dat A data frame
#' @param response The name of a response variable in the data frame (unquoted)
#' @param explanatory The name of the explanatory variable in the data frame (unquoted)
#'
#' @return A data frame of coefficients
#'
#' @import dplyr
#'
#' @expor... |
sv <-
function(data, lower1, upper1, lower2, upper2) {
F <- prepare_data(data, lower1, upper1, lower2, upper2)
S <- starting_values(F)
return(list(mu1=S[1], mu2=S[2], var1=exp(S[3]), cor=S[4], var2=exp(S[5])))
}
starting_values <-
function(F) {
# Generate starting values for the first and seco... | /R/sv.R | no_license | cran/clikcorr | R | false | false | 815 | r | sv <-
function(data, lower1, upper1, lower2, upper2) {
F <- prepare_data(data, lower1, upper1, lower2, upper2)
S <- starting_values(F)
return(list(mu1=S[1], mu2=S[2], var1=exp(S[3]), cor=S[4], var2=exp(S[5])))
}
starting_values <-
function(F) {
# Generate starting values for the first and seco... |
makeCacheMatrix <- function(x = matrix()) {
j <- NULL
set <- function(y){
x <<- y
j <<- NULL
}
get <- function()x
setInverse <- function(inverse) j <<- inverse
getInverse <- function() j
list(set = set, get = get,
setInverse = setInverse,
getInverse = getInverse)
}
##Please inclu... | /cachematrix.R | no_license | Krithika-hub/rasi | R | false | false | 627 | r | makeCacheMatrix <- function(x = matrix()) {
j <- NULL
set <- function(y){
x <<- y
j <<- NULL
}
get <- function()x
setInverse <- function(inverse) j <<- inverse
getInverse <- function() j
list(set = set, get = get,
setInverse = setInverse,
getInverse = getInverse)
}
##Please inclu... |
# ALADYM Age length based dynamic model - version 12.3
# Authors: G. Lembo, I. Bitetto, M.T. Facchini, M.T. Spedicato 2018
# COISPA Tecnologia & Ricerca, Via dei Trulli 18/20 - (Bari), Italy
# In case of use of the model, the Authors should be cited.
# If you have any comments or suggestions please contact the follow... | /BEMTOOL-ver2.5-2018_0901/src/biol/bmtALADYM/ALADYM-ver12.3-2017_0501/gui/fishery/effort.daysFun/add.DAYS.r | no_license | gresci/BEMTOOL2.5 | R | false | false | 1,374 | r | # ALADYM Age length based dynamic model - version 12.3
# Authors: G. Lembo, I. Bitetto, M.T. Facchini, M.T. Spedicato 2018
# COISPA Tecnologia & Ricerca, Via dei Trulli 18/20 - (Bari), Italy
# In case of use of the model, the Authors should be cited.
# If you have any comments or suggestions please contact the follow... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/event_model.R
\name{nuisance}
\alias{nuisance}
\title{nuisance}
\usage{
nuisance(x)
}
\arguments{
\item{x}{a \code{matrix}}
}
\value{
a class of type \code{nuisancespec}
}
\description{
a 'nuisance' term that consists of an arbitrary numeric ... | /man/nuisance.Rd | no_license | muschellij2/fmrireg | R | false | true | 381 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/event_model.R
\name{nuisance}
\alias{nuisance}
\title{nuisance}
\usage{
nuisance(x)
}
\arguments{
\item{x}{a \code{matrix}}
}
\value{
a class of type \code{nuisancespec}
}
\description{
a 'nuisance' term that consists of an arbitrary numeric ... |
\name{summary.tcga.norm}
\alias{summary.tcga.norm}
\docType{data}
\title{
Example dataset of input data for shinyMethyl for the 450k platform
}
\description{
Extracted data from 369 TCGA Head and Neck Cancer DNA methylation samples. The extracted data serve as an example dataset for the package shinyMethyl. Original sa... | /man/summary.tcga.norm.Rd | no_license | Jfortin1/shinyMethylData | R | false | false | 1,169 | rd | \name{summary.tcga.norm}
\alias{summary.tcga.norm}
\docType{data}
\title{
Example dataset of input data for shinyMethyl for the 450k platform
}
\description{
Extracted data from 369 TCGA Head and Neck Cancer DNA methylation samples. The extracted data serve as an example dataset for the package shinyMethyl. Original sa... |
# Tests for file Helper.R
test_that("Test checkInputFileEncoding expected pass", {
testData <- data.frame(id=c(1), name=c("test"))
testFile <- tempfile("test_data.csv")
readr::write_csv(x = testData, file = testFile)
expect_invisible(ROhdsiWebApi::checkInputFileEncoding(testFile))
on.exit(unlink(testFile))
}... | /tests/testthat/test-Helper.R | permissive | OHDSI/ROhdsiWebApi | R | false | false | 471 | r | # Tests for file Helper.R
test_that("Test checkInputFileEncoding expected pass", {
testData <- data.frame(id=c(1), name=c("test"))
testFile <- tempfile("test_data.csv")
readr::write_csv(x = testData, file = testFile)
expect_invisible(ROhdsiWebApi::checkInputFileEncoding(testFile))
on.exit(unlink(testFile))
}... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/generate.graph.params.R
\name{generate.graph.params}
\alias{generate.graph.params}
\title{Generate a graph parameter object to fit admixture graph to observed fstats}
\usage{
generate.graph.params(
graph,
fstats = NULL,
popref = NULL,
... | /man/generate.graph.params.Rd | no_license | cran/poolfstat | R | false | true | 3,227 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/generate.graph.params.R
\name{generate.graph.params}
\alias{generate.graph.params}
\title{Generate a graph parameter object to fit admixture graph to observed fstats}
\usage{
generate.graph.params(
graph,
fstats = NULL,
popref = NULL,
... |
\name{sim.glm}
\alias{sim.glm}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Simulation of glm
}
\description{
function for predictions from the results of model fitting functions (\code{\link{fit.glm}}) or
(\code{\link{glm}})
}
\usage{
sim.glm(fit, datapred, fam.glm = "gaussian", occ.cond = NU... | /man/sim.glm.Rd | no_license | cran/MetGen | R | false | false | 1,163 | rd | \name{sim.glm}
\alias{sim.glm}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Simulation of glm
}
\description{
function for predictions from the results of model fitting functions (\code{\link{fit.glm}}) or
(\code{\link{glm}})
}
\usage{
sim.glm(fit, datapred, fam.glm = "gaussian", occ.cond = NU... |
library(ggplot2)
library(dplyr)
data=read.csv("googleplaystore.csv")
summary(na.omit(data$Rating))
dim(data)
corrupted=data %>% filter(Rating==19)
corrupted
data=subset(data, Category != "1.9")
summary(na.omit(data$Rating))
ggplot(data, aes(x = Rating)) +
geom_histogram()
data=data %>% mutate(Price=na.omi... | /googleplaystore.r | no_license | alekhyatati/GooglePlayStore-Apps-Project | R | false | false | 601 | r | library(ggplot2)
library(dplyr)
data=read.csv("googleplaystore.csv")
summary(na.omit(data$Rating))
dim(data)
corrupted=data %>% filter(Rating==19)
corrupted
data=subset(data, Category != "1.9")
summary(na.omit(data$Rating))
ggplot(data, aes(x = Rating)) +
geom_histogram()
data=data %>% mutate(Price=na.omi... |
#' Daily mean temperatures for Ljubljana from 2016 - 1930
#'
#' A dataset of daily mean temperatures in Ljubljana (Slovenia). The first row
#' represents temperatures in 1930. The first column represents the first day
#' of a year, the second column represents the second day of a year, etc.
#'
#' @format A data f... | /R/LJ_daily_temperatures.R | no_license | cran/dendroTools | R | false | false | 21,113 | r | #' Daily mean temperatures for Ljubljana from 2016 - 1930
#'
#' A dataset of daily mean temperatures in Ljubljana (Slovenia). The first row
#' represents temperatures in 1930. The first column represents the first day
#' of a year, the second column represents the second day of a year, etc.
#'
#' @format A data f... |
#####################################################
## Testing and Summary stats methods for internal use in tableby
###########################################
#' tableby Summary Statistics Functions
#'
#' A collection of functions that will report summary statistics. To create a custom function,
#' consider usin... | /R/tableby.stats.R | no_license | umarfaruk9/arsenal | R | false | false | 17,383 | r | #####################################################
## Testing and Summary stats methods for internal use in tableby
###########################################
#' tableby Summary Statistics Functions
#'
#' A collection of functions that will report summary statistics. To create a custom function,
#' consider usin... |
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test MarkerPosition")
model.instance <- MarkerPosition$new()
test_that("additionalInfo", {
# tests for the property `additionalInfo` (map(character))
# Additional arbitrary info
# un... | /tests/testthat/test_marker_position.R | no_license | Breeding-Insight/brapi-r-v2 | R | false | false | 1,805 | r | # Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test MarkerPosition")
model.instance <- MarkerPosition$new()
test_that("additionalInfo", {
# tests for the property `additionalInfo` (map(character))
# Additional arbitrary info
# un... |
library(tidyverse)
Bom_data <- read_csv("data/Bom_data.csv")
view(Bom_data)
Bom_stations <- read.csv("data/Bom_stations.csv")
view(Bom_stations)
#Challenge 1:
stations_data <- Bom_data %>%
separate(Temp_min_max,into=c("min_temp","max_temp"),sep = "/") %>%
filter(min_temp != "-", max_temp != "-", Rainfall != "... | /scripts.R | no_license | ram-ghimire/bom_challenge | R | false | false | 5,398 | r |
library(tidyverse)
Bom_data <- read_csv("data/Bom_data.csv")
view(Bom_data)
Bom_stations <- read.csv("data/Bom_stations.csv")
view(Bom_stations)
#Challenge 1:
stations_data <- Bom_data %>%
separate(Temp_min_max,into=c("min_temp","max_temp"),sep = "/") %>%
filter(min_temp != "-", max_temp != "-", Rainfall != "... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/slurm_files.R
\name{make_slurm}
\alias{make_slurm}
\title{Creates a SLURM file}
\usage{
make_slurm(
slurm_config,
launcher_file = "",
launcher_prefix = "",
launcher_suffix = "",
...
)
}
\arguments{
\item{slurm_config}{the configurat... | /man/make_slurm.Rd | no_license | Christopher-Peterson/slurmr | R | false | true | 642 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/slurm_files.R
\name{make_slurm}
\alias{make_slurm}
\title{Creates a SLURM file}
\usage{
make_slurm(
slurm_config,
launcher_file = "",
launcher_prefix = "",
launcher_suffix = "",
...
)
}
\arguments{
\item{slurm_config}{the configurat... |
\name{qde}
\Rdversion{2.0}
\alias{qde}
\alias{update.qde}
\title{Quantiles based Density Estimation}
\description{Provides a semiparametric estimation of the quantiles for independented univariate data with possible right censoring. This is same as estimating the intercept function within a joint linear quantile regres... | /qrjoint/man/qde.Rd | no_license | tokdarstat/qrjoint | R | false | false | 9,916 | rd | \name{qde}
\Rdversion{2.0}
\alias{qde}
\alias{update.qde}
\title{Quantiles based Density Estimation}
\description{Provides a semiparametric estimation of the quantiles for independented univariate data with possible right censoring. This is same as estimating the intercept function within a joint linear quantile regres... |
library(ncdf4)
#library(RCurl)
#library(raster)
library(tidyverse)
library(chron)
library(RColorBrewer)
library(lattice)
# http://geog.uoregon.edu/bartlein/courses/geog607/Rmd/netCDF_01.htm
# open NetCDF file
ncfname<-"fram/MARTINI800/Combined_martini800_avg_Chl_surf.nc"
dname <- "Chl" # note: tmp means temperature ... | /app/MARTINI800.R | permissive | NIVANorge/MARTINI | R | false | false | 3,486 | r |
library(ncdf4)
#library(RCurl)
#library(raster)
library(tidyverse)
library(chron)
library(RColorBrewer)
library(lattice)
# http://geog.uoregon.edu/bartlein/courses/geog607/Rmd/netCDF_01.htm
# open NetCDF file
ncfname<-"fram/MARTINI800/Combined_martini800_avg_Chl_surf.nc"
dname <- "Chl" # note: tmp means temperature ... |
#How have emissions from motor vehicle sources changed from 1999–2008 in
# Baltimore City?
## Read data
NEI <- readRDS("data/summarySCC_PM25.rds")
##Select data
### Baltimore City, Maryland (fips == "24510")
### On-road only
BaltimoreEmission.byMotor <-NEI[(NEI$fips=="24510") & (NEI$type=="ON-ROAD"),]
## Calculat... | /plot5.R | no_license | mstaelen/exdata-004 | R | false | false | 794 | r | #How have emissions from motor vehicle sources changed from 1999–2008 in
# Baltimore City?
## Read data
NEI <- readRDS("data/summarySCC_PM25.rds")
##Select data
### Baltimore City, Maryland (fips == "24510")
### On-road only
BaltimoreEmission.byMotor <-NEI[(NEI$fips=="24510") & (NEI$type=="ON-ROAD"),]
## Calculat... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fars_functions.R
\name{fars_read}
\alias{fars_read}
\title{Read Data}
\usage{
fars_read(filename)
}
\arguments{
\item{filename}{A character string giving the filename of the data}
}
\value{
This function returns a data frame
}
\description{
T... | /man/fars_read.Rd | no_license | nandhinidev/farsplot | R | false | true | 515 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fars_functions.R
\name{fars_read}
\alias{fars_read}
\title{Read Data}
\usage{
fars_read(filename)
}
\arguments{
\item{filename}{A character string giving the filename of the data}
}
\value{
This function returns a data frame
}
\description{
T... |
#변수 만들기
a<-1
a
b<-2
b
c<-3
c
d<-3.5
d
#변수를 조합해 연산하기
a+b
a+b+c
4/b
5*b
#여러 값으로 구성된 변수 만들기 (c()함수 이용하기)
var1 <-c(1,2,5,7,8)
var1
#콜론(:)을 이용해 시작 숫자와 마지막 숫자를 입력하면 1씩 증가함
var2 <-c(1:5)
var2
#seq()함수를 이용해 연속적인 값으로 변수 생성
var3 <-seq(1,5)
var3
#by파라미터를 이용해 일정한 간격을 두고 연속된 숫자변수를 만듦
var4<-seq(1,10,by=2)
var4
var5 <-seq(1,... | /practice_1.R | no_license | Kimdumchit/R_practice | R | false | false | 2,140 | r | #변수 만들기
a<-1
a
b<-2
b
c<-3
c
d<-3.5
d
#변수를 조합해 연산하기
a+b
a+b+c
4/b
5*b
#여러 값으로 구성된 변수 만들기 (c()함수 이용하기)
var1 <-c(1,2,5,7,8)
var1
#콜론(:)을 이용해 시작 숫자와 마지막 숫자를 입력하면 1씩 증가함
var2 <-c(1:5)
var2
#seq()함수를 이용해 연속적인 값으로 변수 생성
var3 <-seq(1,5)
var3
#by파라미터를 이용해 일정한 간격을 두고 연속된 숫자변수를 만듦
var4<-seq(1,10,by=2)
var4
var5 <-seq(1,... |
household_power_consumption <- read.csv("~/R/Exploratory Data Analysis/household_power_consumption.txt", sep=";", stringsAsFactors = FALSE, na.strings="?")
# load csv not as factors, ; separator and ?=NA
power_subset <- subset(household_power_consumption, Date == "1/2/2007"| Date == "2/2/2007")
# sub set data
... | /Plot 1.R | no_license | JohanNilsTommy/Exploratory-Data-Analysis-Week-1-Power-Consumption | R | false | false | 762 | r | household_power_consumption <- read.csv("~/R/Exploratory Data Analysis/household_power_consumption.txt", sep=";", stringsAsFactors = FALSE, na.strings="?")
# load csv not as factors, ; separator and ?=NA
power_subset <- subset(household_power_consumption, Date == "1/2/2007"| Date == "2/2/2007")
# sub set data
... |
args = commandArgs(trailingOnly=TRUE)
require(MCMCpack)
library(doParallel)
library(foreach)
library(cluster)
library(Rcpp)
library(RcppArmadillo)
library(RcppGSL)
library(scales)
library(coda)
#Sys.setenv("PKG_CXXFLAGS"="-std=c++11")
#sourceCpp("~/BI/BI.cpp")
qcutAll <- c(0.05, 0.1, 0.15, 0.2, 0.25, 0.3)
localTest <... | /bioinformatics_replication_code/BIsummarySilver.R | no_license | 6guojun/FBM | R | false | false | 16,944 | r | args = commandArgs(trailingOnly=TRUE)
require(MCMCpack)
library(doParallel)
library(foreach)
library(cluster)
library(Rcpp)
library(RcppArmadillo)
library(RcppGSL)
library(scales)
library(coda)
#Sys.setenv("PKG_CXXFLAGS"="-std=c++11")
#sourceCpp("~/BI/BI.cpp")
qcutAll <- c(0.05, 0.1, 0.15, 0.2, 0.25, 0.3)
localTest <... |
# Compare fraction spliced in each of the experiments
# and methods
setwd("../")
library(diem)
library(ggplot2)
library(ggpubr)
library(gridExtra)
library(scales)
source("scripts/common/plotting.R")
#=========================================
# Plot functions
#=========================================
ct <- theme(l... | /scripts/plot_method.droplet_sf.R | no_license | marcalva/DIEM2019 | R | false | false | 6,499 | r |
# Compare fraction spliced in each of the experiments
# and methods
setwd("../")
library(diem)
library(ggplot2)
library(ggpubr)
library(gridExtra)
library(scales)
source("scripts/common/plotting.R")
#=========================================
# Plot functions
#=========================================
ct <- theme(l... |
#=================== src_biogridr Documentation =====================================
#' Connect to local BioGRID database
#'
#' @description
#' Connect to the biogridr package's interaction database
#'
#' @param path Path to BioGRID SQLite database. Defaults to
#' \code{getOption('biogridr.db')}.
#'
#' @details
#'... | /R/src_biogrid.R | no_license | EricEdwardBryant/biogridr | R | false | false | 3,946 | r | #=================== src_biogridr Documentation =====================================
#' Connect to local BioGRID database
#'
#' @description
#' Connect to the biogridr package's interaction database
#'
#' @param path Path to BioGRID SQLite database. Defaults to
#' \code{getOption('biogridr.db')}.
#'
#' @details
#'... |
tidy_CYdata <- function(dataframe){
df <- dataframe %>%
mutate(Date = as.Date(date, format = "%d/%m/%y")) %>%
rename(newcases = daily.new.cases,
newdeaths = daily.deaths,
newrecovered = daily.recovered.cases,
newtests = daily.tests.performed,
totalcases = total... | /useful_functions.R | no_license | solis9753/Covid_19 | R | false | false | 2,313 | r | tidy_CYdata <- function(dataframe){
df <- dataframe %>%
mutate(Date = as.Date(date, format = "%d/%m/%y")) %>%
rename(newcases = daily.new.cases,
newdeaths = daily.deaths,
newrecovered = daily.recovered.cases,
newtests = daily.tests.performed,
totalcases = total... |
ATTEDII_pair <- paste0(CoExp_absth04_cyto$souce, CoExp_absth04_cyto$target)
ATTEDII_pair <- data.frame(AGI_pair = mastercluster_pair,
PCC = CoExp_absth04_cyto$PCC
)
filename <- list.files("~/Nakano_RNAseq/network_analysis/base/genes_set/CY_FDR005_DEGs/CY20/", patte... | /ATTEDII_CY_eachtime_cytoscape.R | no_license | YKeito/ATTEDII | R | false | false | 2,049 | r | ATTEDII_pair <- paste0(CoExp_absth04_cyto$souce, CoExp_absth04_cyto$target)
ATTEDII_pair <- data.frame(AGI_pair = mastercluster_pair,
PCC = CoExp_absth04_cyto$PCC
)
filename <- list.files("~/Nakano_RNAseq/network_analysis/base/genes_set/CY_FDR005_DEGs/CY20/", patte... |
library(deldir)
### Name: divchain
### Title: Dividing chain; generic.
### Aliases: divchain
### Keywords: spatial
### ** Examples
set.seed(42)
x <- runif(50)
y <- runif(50)
z <- factor(kmeans(cbind(x,y),centers=4)$cluster)
dc1 <- divchain(x,y,z,rw=c(0,1,0,1))
dxy <- deldir(x,y,z=z,rw=c(0,1,... | /data/genthat_extracted_code/deldir/examples/divchain.Rd.R | no_license | surayaaramli/typeRrh | R | false | false | 353 | r | library(deldir)
### Name: divchain
### Title: Dividing chain; generic.
### Aliases: divchain
### Keywords: spatial
### ** Examples
set.seed(42)
x <- runif(50)
y <- runif(50)
z <- factor(kmeans(cbind(x,y),centers=4)$cluster)
dc1 <- divchain(x,y,z,rw=c(0,1,0,1))
dxy <- deldir(x,y,z=z,rw=c(0,1,... |
#######################################################
# To create aliquot names for glioma life history.
# Date: 2018.08.30
# Author: Kevin J
#######################################################
# Local directory for github repo.
mybasedir = here::here()
setwd(mybasedir)
# Hong Kong samples sequenced by Novogene.... | /R/manifest/life-history-barcode-generation.R | permissive | fpbarthel/GLASS | R | false | false | 13,364 | r | #######################################################
# To create aliquot names for glioma life history.
# Date: 2018.08.30
# Author: Kevin J
#######################################################
# Local directory for github repo.
mybasedir = here::here()
setwd(mybasedir)
# Hong Kong samples sequenced by Novogene.... |
testlist <- list(b = c(1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, -65281L, -16711841L, -12059008L, -2130837632L, -1895846273L, 38862848L, -16777216L, -16053493L, 1358954496L, -1L, -1L, -1L, -1L, 1090519039L, 973078783L, -8388608L... | /mcga/inst/testfiles/ByteVectorToDoubles/libFuzzer_ByteVectorToDoubles/ByteVectorToDoubles_valgrind_files/1612760937-test.R | no_license | akhikolla/updatedatatype-list3 | R | false | false | 435 | r | testlist <- list(b = c(1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, 1785358954L, -65281L, -16711841L, -12059008L, -2130837632L, -1895846273L, 38862848L, -16777216L, -16053493L, 1358954496L, -1L, -1L, -1L, -1L, 1090519039L, 973078783L, -8388608L... |
#' Blackwell Data for Covariate Balancing Propensity Score
#'
#' This data set gives the outcomes a well as treatment assignments and
#' covariates for the example from Blackwell (2013).
#'
#'
#' @name Blackwell
#' @docType data
#' @format A data frame consisting of 13 columns (including treatment
#' as... | /R/CBPS-package.R | no_license | cran/CBPS | R | false | false | 2,326 | r |
#' Blackwell Data for Covariate Balancing Propensity Score
#'
#' This data set gives the outcomes a well as treatment assignments and
#' covariates for the example from Blackwell (2013).
#'
#'
#' @name Blackwell
#' @docType data
#' @format A data frame consisting of 13 columns (including treatment
#' as... |
# Hadiza Mamman
# Technical Interview
# Analytical Flavor Systems
library(GGally)
library(ggplot2)
library(caret)
library(car)
library(e1071)
library(MASS)
library(moments)
library(corrplot)
library(dplyr)
library(pls)
library(mgcv)
library(nlme)
library(MuMIn)
setwd("~/Desktop/analyticalFlavorSystems/")
redWine <- ... | /WineTasting Code.R | no_license | diza-m/WineTasting | R | false | false | 7,336 | r | # Hadiza Mamman
# Technical Interview
# Analytical Flavor Systems
library(GGally)
library(ggplot2)
library(caret)
library(car)
library(e1071)
library(MASS)
library(moments)
library(corrplot)
library(dplyr)
library(pls)
library(mgcv)
library(nlme)
library(MuMIn)
setwd("~/Desktop/analyticalFlavorSystems/")
redWine <- ... |
#' Improved function for reducing an adjacency matrix to present compounds,
#' with the option to include `n`-nearest neighours.
#' - A bit of testing puts it at ~0.023 seconds to reduce the full adjacency
#' matrix (8810 compounds) to 207 compounds, with `n = 0`.
#' @param adjmat Adjacency matrix to reduce.
#' @para... | /old/kegg/networkApp202012/coreData/functions/adjmatReduceNplus.R | permissive | glm729/anpc_public | R | false | false | 2,855 | r | #' Improved function for reducing an adjacency matrix to present compounds,
#' with the option to include `n`-nearest neighours.
#' - A bit of testing puts it at ~0.023 seconds to reduce the full adjacency
#' matrix (8810 compounds) to 207 compounds, with `n = 0`.
#' @param adjmat Adjacency matrix to reduce.
#' @para... |
# cv for classification tree (smoker)
# models used
glm.smoker.2$call #glm
bestmod$call #svm
nn3$call #neural network
set.seed(5)
MC.1 <- c()
MC.2 <- c()
MC.3 <- c()
for(i in 1:10){
train.YES <- sample(x = c(TRUE, FALSE),
size = nrow(insurance),
replace = TRUE)
... | /02_analysis/cv_classification2.R | no_license | caro-mat/machinelearning | R | false | false | 3,517 | r | # cv for classification tree (smoker)
# models used
glm.smoker.2$call #glm
bestmod$call #svm
nn3$call #neural network
set.seed(5)
MC.1 <- c()
MC.2 <- c()
MC.3 <- c()
for(i in 1:10){
train.YES <- sample(x = c(TRUE, FALSE),
size = nrow(insurance),
replace = TRUE)
... |
#' Run the party calls classifier
#'
#' Use the iterative algorithm that (1) predicts ideal points based on last
#' iteration's non-party calls, (2) runs regressions of roll call vote on
#' ideal points and party, (3) classify new iteration of non-party calls as
#' votes for which the p value on party is > .05.
#' @pa... | /old/modified_summer_version_tests.R | no_license | Hershberger/partycalls | R | false | false | 5,711 | r |
#' Run the party calls classifier
#'
#' Use the iterative algorithm that (1) predicts ideal points based on last
#' iteration's non-party calls, (2) runs regressions of roll call vote on
#' ideal points and party, (3) classify new iteration of non-party calls as
#' votes for which the p value on party is > .05.
#' @pa... |
rm(list=ls())
library(lubridate)
library(sqldf)
library(DMwR)
hpd200405<- read.table("200405hpd.txt", sep=",",header = T, dec = ".") # Read 01 File
# Changing Format as applicable
hpd200405$YearMonthDay<-ymd(hpd200405$YearMonthDay)
hpd200405$YearMonthDay<-as.factor(hpd200405$YearMonthDay)
hpd200405$Weat... | /Aircraft Delay Prediction/2_HourlyPrecipitation/Train/hpd05.R | no_license | kunalrayscorpio/DSProjects | R | false | false | 4,680 | r | rm(list=ls())
library(lubridate)
library(sqldf)
library(DMwR)
hpd200405<- read.table("200405hpd.txt", sep=",",header = T, dec = ".") # Read 01 File
# Changing Format as applicable
hpd200405$YearMonthDay<-ymd(hpd200405$YearMonthDay)
hpd200405$YearMonthDay<-as.factor(hpd200405$YearMonthDay)
hpd200405$Weat... |
## set working directory
#setwd("/media/ssdp1/Coursera/ExploratoryDataAnalysis-2014/data/")
#One off commands to get data
#download.file("https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip","./data/exdata_data_household_power_consumption.zip","curl")
##unzip data
unzip("exdata_data_ho... | /plot4.R | no_license | allene/ExData_Plotting1 | R | false | false | 2,921 | r | ## set working directory
#setwd("/media/ssdp1/Coursera/ExploratoryDataAnalysis-2014/data/")
#One off commands to get data
#download.file("https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip","./data/exdata_data_household_power_consumption.zip","curl")
##unzip data
unzip("exdata_data_ho... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/daily_stat.R
\name{daily_stat_page}
\alias{daily_stat_page}
\alias{no2_daily_max}
\alias{o3_daily_max}
\alias{pm_daily_avg}
\alias{so2_daily_max}
\title{Cacluate daily maxima or averages for different sensor readings.}
\usage{
o3_daily_max(da... | /man/daily_stat_page.Rd | permissive | paulroberts68/rcaaqs | R | false | true | 1,736 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/daily_stat.R
\name{daily_stat_page}
\alias{daily_stat_page}
\alias{no2_daily_max}
\alias{o3_daily_max}
\alias{pm_daily_avg}
\alias{so2_daily_max}
\title{Cacluate daily maxima or averages for different sensor readings.}
\usage{
o3_daily_max(da... |
N <- 1000
Mu <- c(0, 5, 2)
Sigma <- cbind(
c(25, -1, 7),
c(-1, 4, -4),
c(7, -4, 10)
)
library('MASS')
X <- mvrnorm(n = 1000, mu = Mu, Sigma = Sigma)
# install.packages('rgl')
library('rgl')
plot3d(X)
ev <- eigen(Sigma)
eigenvalues <- ev$values
eigenvectors <- ev$vectors
PCA <- prcomp(X)
PCA.PC1 <- PCA$x[,1]
... | /Problemes/P2-3/p3.R | no_license | josepdecid/APA-FIB | R | false | false | 697 | r | N <- 1000
Mu <- c(0, 5, 2)
Sigma <- cbind(
c(25, -1, 7),
c(-1, 4, -4),
c(7, -4, 10)
)
library('MASS')
X <- mvrnorm(n = 1000, mu = Mu, Sigma = Sigma)
# install.packages('rgl')
library('rgl')
plot3d(X)
ev <- eigen(Sigma)
eigenvalues <- ev$values
eigenvectors <- ev$vectors
PCA <- prcomp(X)
PCA.PC1 <- PCA$x[,1]
... |
rit_to_efl <- read.csv('./data-raw/rit_to_efl.csv', stringsAsFactors = FALSE, na.strings = '')
# data cleaning -----------------------------------------------------------
library(dplyr)
rit_to_efl <- rit_to_efl %>%
filter(!is.na(rit)) %>%
select(rit, tabe_reading:nrs_efl) %>%
arrange(rit, tabe_reading)
# Rem... | /data-raw/rit_to_efl.R | no_license | thelayc/laycca | R | false | false | 773 | r | rit_to_efl <- read.csv('./data-raw/rit_to_efl.csv', stringsAsFactors = FALSE, na.strings = '')
# data cleaning -----------------------------------------------------------
library(dplyr)
rit_to_efl <- rit_to_efl %>%
filter(!is.na(rit)) %>%
select(rit, tabe_reading:nrs_efl) %>%
arrange(rit, tabe_reading)
# Rem... |
#Editing names
names(theDF) <- c("popularity", "team strength", "sport")
View(theDF)
#summary of referrencing data from elements
theDF[2,3]
theDF[c(1,3)]
theDF[3]
theDF$sport
theDF["sport"]
theDF$"Team strength"
View(theDF) | /Assignment02b.R | no_license | JohnDanforth/Assignment02b.R | R | false | false | 225 | r | #Editing names
names(theDF) <- c("popularity", "team strength", "sport")
View(theDF)
#summary of referrencing data from elements
theDF[2,3]
theDF[c(1,3)]
theDF[3]
theDF$sport
theDF["sport"]
theDF$"Team strength"
View(theDF) |
# load the library
library(caret)
library(doParallel)
set.seed(1)
t <- proc.time()
cl <- makeCluster(detectCores()-1)
registerDoParallel(cl)
# Prepare train data
digits_csv <- read.csv("./digits.csv", head = FALSE)
train_data <- digits_csv[,-65]
train_labels <- as.factor(digits_csv[, 65])
# Prepare test data
test_c... | /week_4-5/algorithms-10-fold-tune/rpart.R | no_license | el-sorral/BigData-Masteam-UPC | R | false | false | 1,184 | r | # load the library
library(caret)
library(doParallel)
set.seed(1)
t <- proc.time()
cl <- makeCluster(detectCores()-1)
registerDoParallel(cl)
# Prepare train data
digits_csv <- read.csv("./digits.csv", head = FALSE)
train_data <- digits_csv[,-65]
train_labels <- as.factor(digits_csv[, 65])
# Prepare test data
test_c... |
library(glmnet)
mydata = read.table("../../../../TrainingSet/FullSet/Lasso/lymphoid.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.04,family="gaussian",standardize=FALSE)
sink('./lymphoid_020.txt',append=TRUE)
... | /Model/EN/Lasso/lymphoid/lymphoid_020.R | no_license | esbgkannan/QSMART | R | false | false | 349 | r | library(glmnet)
mydata = read.table("../../../../TrainingSet/FullSet/Lasso/lymphoid.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.04,family="gaussian",standardize=FALSE)
sink('./lymphoid_020.txt',append=TRUE)
... |
library(ggplot2)
library(dplyr)
# data("diamonds")
# while(TRUE){
# temp=sample_frac(diamonds,0.1)
# write.csv(temp, paste0("sampled", gsub("[^0-9]","",Sys.time()),".csv"),
# row.names = FALSE)
# Sys.sleep(2) # Suspend execution of R expressions. The time interval to suspend execution for, in seconds... | /03-SNA/tesstream/global.R | permissive | eppofahmi/belajaR | R | false | false | 417 | r | library(ggplot2)
library(dplyr)
# data("diamonds")
# while(TRUE){
# temp=sample_frac(diamonds,0.1)
# write.csv(temp, paste0("sampled", gsub("[^0-9]","",Sys.time()),".csv"),
# row.names = FALSE)
# Sys.sleep(2) # Suspend execution of R expressions. The time interval to suspend execution for, in seconds... |
#####################
# load libraries
# set wd
# clear global .envir
#####################
# remove objects
rm(list=ls())
# detach all libraries
detachAllPackages <- function() {
basic.packages <- c("package:stats", "package:graphics", "package:grDevices", "package:utils", "package:datasets", "package:methods", "pa... | /problem_sets/PS4/Answer/PS4_Answer.R | no_license | Yumeng-Xu/QTM200Spring2020 | R | false | false | 5,613 | r | #####################
# load libraries
# set wd
# clear global .envir
#####################
# remove objects
rm(list=ls())
# detach all libraries
detachAllPackages <- function() {
basic.packages <- c("package:stats", "package:graphics", "package:grDevices", "package:utils", "package:datasets", "package:methods", "pa... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_res.R, R/res.plot.R
\name{res.plot}
\alias{res.plot}
\title{Plotting the results}
\usage{
res.plot(
res.tcG = NULL,
res.extGP = NULL,
y,
ym = 0,
step = 0,
zoom = range(y, na.rm = TRUE),
select = NULL,
choice = c("dens", "... | /man/res.plot.Rd | permissive | mbtgy/tcG | R | false | true | 2,939 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_res.R, R/res.plot.R
\name{res.plot}
\alias{res.plot}
\title{Plotting the results}
\usage{
res.plot(
res.tcG = NULL,
res.extGP = NULL,
y,
ym = 0,
step = 0,
zoom = range(y, na.rm = TRUE),
select = NULL,
choice = c("dens", "... |
#set working directory
setwd("/Users/theochristian/Dropbox/Coursera/exploratory_data_analysis/Assignment1/ExData_Plotting1")
# load req libraries
library(data.table)
library(lubridate)
# read in data for period 1/2/2007 - 2/2/2007 from source text file
variable.class<-c(rep('character',2),rep('numeric',7))
power.cons... | /plot4.R | no_license | tgjc/ExData_Plotting1 | R | false | false | 2,123 | r | #set working directory
setwd("/Users/theochristian/Dropbox/Coursera/exploratory_data_analysis/Assignment1/ExData_Plotting1")
# load req libraries
library(data.table)
library(lubridate)
# read in data for period 1/2/2007 - 2/2/2007 from source text file
variable.class<-c(rep('character',2),rep('numeric',7))
power.cons... |
#
# This is the server logic of a Shiny web application. You can run the
# application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
library(plotly)
load("covidcases.Rda")
# Define server logic required to draw a histogra... | /server.R | no_license | Aniaw81/COVID19shiny | R | false | false | 1,253 | r | #
# This is the server logic of a Shiny web application. You can run the
# application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
library(plotly)
load("covidcases.Rda")
# Define server logic required to draw a histogra... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/makeA.R
\name{makeA}
\alias{makeA}
\title{Creates the additive genetic relationship matrix}
\usage{
makeA(pedigree)
}
\arguments{
\item{pedigree}{A pedigree where the columns are ordered ID, Dam, Sire}
}
\value{
Returns A, or the numerator re... | /man/makeA.Rd | no_license | matthewwolak/nadiv | R | false | true | 847 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/makeA.R
\name{makeA}
\alias{makeA}
\title{Creates the additive genetic relationship matrix}
\usage{
makeA(pedigree)
}
\arguments{
\item{pedigree}{A pedigree where the columns are ordered ID, Dam, Sire}
}
\value{
Returns A, or the numerator re... |
library(ggplot2)
library(gridExtra)
rm(list=ls())
setwd("/Users/sunhuabin/Dropbox/Data/Electric Data/interlayer effect/pulse test")
getwd
## Working path setting
PulseN <- read.csv("N 100u 20v.csv", header=T)
PulseP <- read.csv("p1 100u 20v.csv", header=T)
DeviceIDN <- rep("Device withtout PMMA", times=565)
DeviceIDP... | /RScriptForSp/Plot Puls - Id relation.R | no_license | skatingsun/R-for-Data-analysis | R | false | false | 5,046 | r | library(ggplot2)
library(gridExtra)
rm(list=ls())
setwd("/Users/sunhuabin/Dropbox/Data/Electric Data/interlayer effect/pulse test")
getwd
## Working path setting
PulseN <- read.csv("N 100u 20v.csv", header=T)
PulseP <- read.csv("p1 100u 20v.csv", header=T)
DeviceIDN <- rep("Device withtout PMMA", times=565)
DeviceIDP... |
#' Organising my workspace
#'
#' This package contains code to organise code and data within my workspace.
#'
#' @docType package
#' @name workspace
#'
NULL
| /R/0_package.R | no_license | rcannood/workspace | R | false | false | 158 | r | #' Organising my workspace
#'
#' This package contains code to organise code and data within my workspace.
#'
#' @docType package
#' @name workspace
#'
NULL
|
#' Play the ``Lights Out'' game in R
#'
#' By default, the white squares in the plot denote the lights that are on, and
#' black ones for the off. When you click on a light, this light as well as the
#' four neighbors will switch theirs status. Your mission is to close all the
#' lights.
#' @param width number of light... | /R/lights_out.R | no_license | maryglover/fun | R | false | false | 3,064 | r | #' Play the ``Lights Out'' game in R
#'
#' By default, the white squares in the plot denote the lights that are on, and
#' black ones for the off. When you click on a light, this light as well as the
#' four neighbors will switch theirs status. Your mission is to close all the
#' lights.
#' @param width number of light... |
\name{Conditional independence tests for survival data }
\alias{censIndCR}
\alias{censIndWR}
\alias{censIndER}
\alias{permCR}
\alias{permWR}
\alias{permER}
\alias{waldCR}
\alias{waldWR}
\alias{waldER}
\title{
Conditional independence test for survival data
}
\description{
The main task of this test is ... | /man/censIndCR.Rd | no_license | JokerWhy233/MXM | R | false | false | 8,975 | rd | \name{Conditional independence tests for survival data }
\alias{censIndCR}
\alias{censIndWR}
\alias{censIndER}
\alias{permCR}
\alias{permWR}
\alias{permER}
\alias{waldCR}
\alias{waldWR}
\alias{waldER}
\title{
Conditional independence test for survival data
}
\description{
The main task of this test is ... |
### Prepare Data ###
DateStart <- as.POSIXlt("2007-02-01 00:00:00")
DateEnd <- as.POSIXlt("2007-02-02 23:59:59")
data <- read.table("household_power_consumption.txt",sep=";",header=TRUE,na.strings = '?', blank.lines.skip = TRUE)
DateTime<-strptime(paste(data$Date,data$Time),"%d/%m/%Y %H:%M:%S")
data<- cbind(data,Dat... | /plot3.R | no_license | tomchal/ExData_Plotting1 | R | false | false | 847 | r | ### Prepare Data ###
DateStart <- as.POSIXlt("2007-02-01 00:00:00")
DateEnd <- as.POSIXlt("2007-02-02 23:59:59")
data <- read.table("household_power_consumption.txt",sep=";",header=TRUE,na.strings = '?', blank.lines.skip = TRUE)
DateTime<-strptime(paste(data$Date,data$Time),"%d/%m/%Y %H:%M:%S")
data<- cbind(data,Dat... |
read.fmridata <- function( directory, format, prefix, nimages, dim.image, nii=TRUE )
{
fmridata <- array(NA, dim=c(dim.image,nimages))
if(format=="Analyze")
{
for(i in 1:nimages)
{
if (i <= 9) aux <- paste0("000",i,".img")
if ((i > 9) && (i <= 99)) aux <- paste0("00",i,".img")
if (... | /R/11.read.fmridata.r | no_license | Tavpritesh/BHMSMAfMRI | R | false | false | 1,154 | r | read.fmridata <- function( directory, format, prefix, nimages, dim.image, nii=TRUE )
{
fmridata <- array(NA, dim=c(dim.image,nimages))
if(format=="Analyze")
{
for(i in 1:nimages)
{
if (i <= 9) aux <- paste0("000",i,".img")
if ((i > 9) && (i <= 99)) aux <- paste0("00",i,".img")
if (... |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/regression.R
\name{setKernel.default}
\alias{setKernel.default}
\title{\code{RegFitObj} (regression approach)}
\usage{
\method{setKernel}{default}(rfo, Kernel)
}
\arguments{
\item{rfo}{[\code{RegFitObj}(1)]\cr
object taken in the argument.}
... | /man/setKernel.default.Rd | no_license | cran/survivalsvm | R | false | true | 503 | rd | % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/regression.R
\name{setKernel.default}
\alias{setKernel.default}
\title{\code{RegFitObj} (regression approach)}
\usage{
\method{setKernel}{default}(rfo, Kernel)
}
\arguments{
\item{rfo}{[\code{RegFitObj}(1)]\cr
object taken in the argument.}
... |
tidy_data_convert_spreadsheet <- function(input_file_name) {
# read in the csv file with correct date format using readr and read_csv
covid_data_tidy <- readr::read_csv(input_file_name)
# convert read file into a long spreadsheet format
covid_tidy_data_long <- covid_data_tidy %>%
pivot_longer(!c(
tran... | /code/functions/tidy_data_convert_spreadsheet.R | no_license | mbogaczynska/apple_mobility_data | R | false | false | 902 | r | tidy_data_convert_spreadsheet <- function(input_file_name) {
# read in the csv file with correct date format using readr and read_csv
covid_data_tidy <- readr::read_csv(input_file_name)
# convert read file into a long spreadsheet format
covid_tidy_data_long <- covid_data_tidy %>%
pivot_longer(!c(
tran... |
#' SP500_px
#'
#'the daily returns for telecommunication stocks
#'from July 2012 through June 2015.
#'
#' @docType data
#'
#' @usage data(sp500_px)
#'
#' @keywords datasets
#'
#'
#' @examples
#' data(sp500_px)
"sp500_px"
#' SP500_sym
#'
#'the daily returns for telecommunication stocks
#'from July 2012 through June 20... | /R/sp500-data.R | no_license | g4challenge/statistics-for-data-scientists | R | false | false | 445 | r | #' SP500_px
#'
#'the daily returns for telecommunication stocks
#'from July 2012 through June 2015.
#'
#' @docType data
#'
#' @usage data(sp500_px)
#'
#' @keywords datasets
#'
#'
#' @examples
#' data(sp500_px)
"sp500_px"
#' SP500_sym
#'
#'the daily returns for telecommunication stocks
#'from July 2012 through June 20... |
systematic.resample = function(weights, num.samples=length(weights), engine="R")
{
check.weights(weights, log=F, normalized=T)
stopifnot(num.samples>0)
engine=pmatch(engine, c("R","C"))
n = length(weights)
switch(engine,
{
u = stats::runif(1,0,1/num.samples)+seq(0,by=1/num.samples,len... | /R/systematic.resample.R | no_license | AnthonyEbert/smcUtils | R | false | false | 668 | r |
systematic.resample = function(weights, num.samples=length(weights), engine="R")
{
check.weights(weights, log=F, normalized=T)
stopifnot(num.samples>0)
engine=pmatch(engine, c("R","C"))
n = length(weights)
switch(engine,
{
u = stats::runif(1,0,1/num.samples)+seq(0,by=1/num.samples,len... |
rm(list = ls())
n.range = 1:(1e6-1)
collatz = function(n){
if (n %% 2 == 0){
return(n / 2)
} else{
return(3 * n + 1)
}
}
collatz.seq = function(n){
n.seq = n
i = 1
while (n.seq[i] > 1){
n.seq[i + 1] = collatz(n.seq[i])
i = i + 1
}
return(n.seq)
}
collatz.length = function(n){
n.cu... | /PE/14.R | no_license | tkmckenzie/pan | R | false | false | 511 | r | rm(list = ls())
n.range = 1:(1e6-1)
collatz = function(n){
if (n %% 2 == 0){
return(n / 2)
} else{
return(3 * n + 1)
}
}
collatz.seq = function(n){
n.seq = n
i = 1
while (n.seq[i] > 1){
n.seq[i + 1] = collatz(n.seq[i])
i = i + 1
}
return(n.seq)
}
collatz.length = function(n){
n.cu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.