Skip to content

Commit

Permalink
0.6.2 - fix DataSummary issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SixiangHu committed Jul 18, 2018
1 parent 6746735 commit 5938373
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 19 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: DataMan
Type: Package
Title: Data Summary, One-way Interactive Plot and Model Visualisation Analysis
Version: 0.6.1
Date: 2018-6-17
Version: 0.6.2
Date: 2018-7-18
Author: Sixiang Hu <[email protected]>
Maintainer: Sixiang Hu <[email protected]>
Description: DataMan package provides functions for data summary, one-way plot, and model assess functionalities with 2D and 3D interactive visualisation.
Expand Down
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export(resiPlot)
export(rocPlot)
export(tree2data)
export(varComp)
import(data.table)
importFrom(ROCR,performance)
importFrom(ROCR,prediction)
importFrom(Rcpp,evalCpp)
Expand All @@ -45,8 +46,6 @@ importFrom(checkmate,testNumeric)
importFrom(data.table,":=")
importFrom(data.table,as.data.table)
importFrom(data.table,data.table)
importFrom(data.table,dcast)
importFrom(data.table,key)
importFrom(data.table,melt)
importFrom(data.table,set)
importFrom(data.table,setDT)
Expand All @@ -69,5 +68,6 @@ importFrom(plotly,subplot)
importFrom(randomForest,getTree)
importFrom(stats,chisq.test)
importFrom(stats,na.omit)
importFrom(stats,var)
importFrom(stats,weighted.mean)
useDynLib(DataMan)
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
DataMan 0.6.2
-------------------------------------------------------------
BUG FIXES AND MINOR IMPROVEMENTS
* `DataSummary` Fix issue #48: unique value count is not correct when `NA` included.
* `DataSummary` Fix issue #49: mean value is not correct when `NA` included.

DataMan 0.6.1
-------------------------------------------------------------
NEW FEATURES
Expand Down
10 changes: 5 additions & 5 deletions R/DataSummary.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' DataSummary
#'
#' @description function gives summary of the dataset.
#' @usage DataSummary(data,missing=list(NA),wt=NULL,entropy=FALSE,
#' @usage DataSummary(data,missing=list(NA,NaN,Inf,-Inf),wt=NULL,entropy=FALSE,
#' entropy_method="emp",sparkline=FALSE)
#' @param data This could be data frame, a vector, matrix or data.table.
#' @param missing list of possible missing values.
Expand All @@ -22,15 +22,15 @@
#' @importFrom checkmate testCharacter testNumeric
#' @export DataSummary
#' @examples
#' DataSummary(mtcars,missing=list(NA,".","Unknown",-1))
#' DataSummary(mtcars,missing=list(NA,NaN,Inf,-Inf,".","Unknown",-1))

DataSummary <- function(data,missing=list(NA,NaN,Inf),wt=NULL,entropy=FALSE,entropy_method="emp",sparkline=FALSE){
DataSummary <- function(data,missing=list(NA,NaN,Inf,-Inf),wt=NULL,entropy=FALSE,entropy_method="emp",sparkline=FALSE){
UseMethod("DataSummary",data)
}

#' @export
#' @rdname DataSummary
DataSummary.data.frame <- function(data,missing=list(NA),wt=NULL,
DataSummary.data.frame <- function(data,missing=list(NA,NaN,Inf,-Inf),wt=NULL,
entropy=FALSE,entropy_method="emp",sparkline=FALSE){
setDT(data)
DataSummary.data.table(data,missing,wt,entropy,entropy_method,sparkline)
Expand All @@ -39,7 +39,7 @@ DataSummary.data.frame <- function(data,missing=list(NA),wt=NULL,
#' @export
#' @rdname DataSummary
#'
DataSummary.data.table <- function(data,missing=list(NA),wt=NULL,
DataSummary.data.table <- function(data,missing=list(NA,NaN,Inf,-Inf),wt=NULL,
entropy=FALSE,entropy_method="emp",sparkline=FALSE){

if(is.null(wt)) weight <- rep(1,nrow(data))
Expand Down
4 changes: 2 additions & 2 deletions R/interPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' This is really useful when modeller wants to assess the interaction terms.
#' Hence the `z` can be actual response data or model predictions.
#' @author Sixiang Hu
#' @importFrom data.table data.table setkey key := dcast
#' @import data.table
#' @importFrom plotly plot_ly layout add_surface %>%
#' @export interPlot
#' @examples
Expand Down Expand Up @@ -72,4 +72,4 @@ interPlot <- function(x,y,z,weight=NULL,exposure=NULL,numGrpx=10,numGrpy=10,
}

#global variable
globalVariables(c("e","w"))
globalVariables(c("e","w","."))
5 changes: 3 additions & 2 deletions R/resiPlot.r
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
#' heterogeneity
#'
#' @author Sixiang Hu
#' @importFrom data.table setkey data.table
#' @import data.table
#' @importFrom plotly plot_ly add_histogram2dcontour add_trace %>% subplot
#' @importFrom stats var
#' @export resiPlot
#' @examples
#' set.seed(1L)
Expand Down Expand Up @@ -88,4 +89,4 @@ resiPlot <- function(act,pred,weight=NULL,exposure=NULL,bucket=20){
}

#global variable
globalVariables(c("x","e","w"))
globalVariables(c("x","e","w","."))
12 changes: 6 additions & 6 deletions man/DataSummary.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5938373

Please sign in to comment.