Skip to content

Commit

Permalink
change correlation function name, also added the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo14 committed Mar 27, 2016
1 parent ffc6f5f commit 0570b9f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .Rproj.user/D07DC6CE/pcs/source-pane.pper
@@ -1,4 +1,4 @@
{
"activeTab" : 2,
"activeTab" : -1,
"activeTabSourceWindow1" : 0
}
2 changes: 1 addition & 1 deletion .Rproj.user/D07DC6CE/pcs/windowlayoutstate.pper
Expand Up @@ -2,7 +2,7 @@
"left" : {
"panelheight" : 656,
"splitterpos" : 259,
"topwindowstate" : "NORMAL",
"topwindowstate" : "HIDE",
"windowheight" : 694
},
"right" : {
Expand Down
4 changes: 2 additions & 2 deletions .Rproj.user/D07DC6CE/pcs/workbench-pane.pper
@@ -1,6 +1,6 @@
{
"TabSet1" : 2,
"TabSet2" : 1,
"TabSet1" : 0,
"TabSet2" : 3,
"TabZoom" : {
}
}
2 changes: 2 additions & 0 deletions NEWS
@@ -1,5 +1,7 @@
funModeling v2.0 (Release date: 2016-xxxxx)
==============


Minor improvements:
- New parameter in df_status: print_results, if FALSE then there isn't a print console.
- If str_input is missing in cross_plot , then it runs for all variables
Expand Down
16 changes: 6 additions & 10 deletions R/numbers.R
@@ -1,21 +1,17 @@
#' @title Plot
#' @description For each variable it returns: Quantity and percentage of zeros (q_zeros and p_zeros respectevly). Same metrics for NA values (q_NA and p_na). Last two columns indicates data type and quantity of unique values.
#' This function print and return the results.
#' @title Correlation index against target variable
#' @description Obtain correlation table of all variables that belongs to data against target variable
#' @param data data frame
#' @param str_target string variable to predict
#' @examples
#' df_status(heart_disease)
#' @return Metrics data frame
#' correlation_table(data=heart_disease, str_target="has_heart_disease")
#' @return Correlation index for all data input variable
#' @export
get_cor_matrix <- function(data, str_target)
correlation_table <- function(data, str_target)
{
str_target="has_heart_disease"
data=heart_disease

data[, str_target]=as.numeric(data[, str_target])

data=data[, c(give_me_num_vars(data, str_target), str_target)]


df_cor=as.data.frame(round(cor(data, use="complete.obs" ),2))
df_cor$Variable = rownames(df_cor)
df_cor=df_cor[, names(df_cor) %in% c(str_target, "Variable")]
Expand Down

0 comments on commit 0570b9f

Please sign in to comment.