Skip to content

Commit

Permalink
Add new method md5 for use in jstat methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mhebing committed Aug 16, 2013
1 parent 1e88aea commit 54b500f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ Collate:
'jstat.character.R'
'jstat.labeled_numeric.R'
'jstat.numeric.R'
'md5.R'
6 changes: 1 addition & 5 deletions R/jstat.character.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jstat.character <- function(variable, time=NULL)
{
main <- function() {
l <- list(table = .table(variable$data_table$valid, time),
md5 = .md5(variable$data_table$valid))
md5 = md5(variable$data_table$valid))
l
}

Expand All @@ -22,10 +22,6 @@ jstat.character <- function(variable, time=NULL)
x
}

.md5 <- function(valid) {
digest(paste(valid, collapse = ''), serialize = FALSE)
}

main()
}

6 changes: 1 addition & 5 deletions R/jstat.labeled_numeric.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jstat.labeled_numeric <- function(variable, time=NULL)
{
main <- function() {
l <- list(table = .table(variable$data_table$valid, time),
md5 = .md5(variable$data_table$valid))
md5 = md5(variable$data_table$valid))
l
}

Expand All @@ -22,10 +22,6 @@ jstat.labeled_numeric <- function(variable, time=NULL)
x
}

.md5 <- function(valid) {
digest(paste(valid, collapse = ''), serialize = FALSE)
}

main()
}

6 changes: 1 addition & 5 deletions R/jstat.numeric.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jstat.numeric <- function(variable, time=NULL)
{
main <- function() {
l <- list(densit = .density(variable$data_table$valid),
md5 = .md5(variable$data_table$valid))
md5 = md5(variable$data_table$valid))
l
}

Expand All @@ -18,10 +18,6 @@ jstat.numeric <- function(variable, time=NULL)
d
}

.md5 <- function(valid) {
digest(paste(valid, collapse = ''), serialize = FALSE)
}

main()
}

12 changes: 12 additions & 0 deletions R/md5.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#' Hash function for internal use
#'
#' @param valid
#' @param id
md5 <- function(valid, id = NULL)
{
if(is.null(id))
id <- 1:length(valid)
valid <- valid[order(id)]
digest(paste(valid, collapse = ''), serialize = FALSE)
}

1 comment on commit 54b500f

@mhebing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close #23

Please sign in to comment.