Skip to content

Commit

Permalink
My start into package construction.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bharath HU authored and Bharath Air committed Apr 20, 2020
0 parents commit 1f94258
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
^.*\.Rproj$
^\.Rproj\.user$
12 changes: 12 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Package: compareRhythms
Type: Package
Title: Implementation of Various Workflows for Differential Rhythm Analysis
Version: 0.1.0
Author: Who wrote it
Maintainer: The package maintainer <[email protected]>
Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description.
License: What license is it under?
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated by roxygen2: do not edit by hand

36 changes: 36 additions & 0 deletions R/compareRhythms_rain.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
compareRhythms_rain <- function(y, expDesign, Tau=24){

expDesign <- cbind(expDesign, colNumber = seq(nrow(expDesign)))
group_IDs <- base::unique(expDesign$group)
expDesign_A <- base::subset(expDesign, group == group_IDs[1])

expDesign_A <- expDesign_A[base::order(expDesign_A$time),]

expDesign_B <- base::subset(expDesign, group == group_IDs[2])

expDesign_B <- expDesign_B[base::order(expDesign_B$time),]

deltat_A <- min(diff(unique(expDesign_A$time)))


time_A <- base::seq(min(expDesign_A$time),
max(expDesign_A$time),
by = deltat_A)

measure.sequence_A <- base::table(expDesign_A$time)
measure.sequence_A <- base::sapply(time_A, function(t) ifelse(any(names(measure.sequence_A) == t),
measure.sequence_A[names(measure.sequence_A) == t],
0))
deltat_B <- min(diff(unique(expDesign_B$time)))


time_B <- base::seq(min(expDesign_B$time),
max(expDesign_B$time),
by = deltat_B)

measure.sequence_B <- table(expDesign_B$time)
measure.sequence_B <- sapply(time_B, function(t) ifelse(any(names(measure.sequence_B) == t),
measure.sequence_B[names(measure.sequence_B) == t],
0))
return(expDesign_B)
}
21 changes: 21 additions & 0 deletions compareRhythms.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: knitr
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace,vignette

0 comments on commit 1f94258

Please sign in to comment.