Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add defaults and fix ranking by log odds
  • Loading branch information
matthewjdenny committed Jan 9, 2018
1 parent bcdcf31 commit 3ed1e41
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
Binary file modified .DS_Store
Binary file not shown.
18 changes: 12 additions & 6 deletions R/fightin_words_plot.R
Expand Up @@ -3,11 +3,14 @@
#'
#' @param feature_selection_object A list object generated by the
#' feature_selection function.
#' @param title A user supplied title for the plot.
#' @param title A user supplied title for the plot. Defaults to "", in which
#' case a blank title is displayed.
#' @param positive_category The name the user wishes to give to the first
#' category specified when using the feature_selection function.
#' category specified when using the feature_selection function. Defaults to
#' "Category 1".
#' @param negative_category The name the user wishes to give to the second
#' category specified when using the feature_selection function.
#' category specified when using the feature_selection function. Defaults to
#' "Category 2".
#' @param xlab Defaults to 'Term Frequency', but can be modified as necessary.
#' @param display_top_words Defaults to 20 and controls the number of top terms
#' for each category displayed in the plot.
Expand Down Expand Up @@ -38,9 +41,9 @@
#' @return A Fightin' Words plot
#' @export
fightin_words_plot <- function(feature_selection_object,
title,
positive_category,
negative_category,
title = "",
positive_category = "Category 1",
negative_category = "Category 2",
xlab = "term count",
display_top_words = 20,
display_terms_next_to_points = FALSE,
Expand All @@ -61,6 +64,9 @@ fightin_words_plot <- function(feature_selection_object,
zeta <- feature_selection_object[[3]]$scores
y.tot <- feature_selection_object[[3]]$total_count
words <- feature_selection_object[[3]]$terms
if (!is.null(feature_selection_object$rank_by_log_odds)) {
rank_by_log_odds <- feature_selection_object$rank_by_log_odds
}
} else if (class(feature_selection_object) == "data.frame") {
z_scores <- feature_selection_object$z_scores
zeta <- feature_selection_object$scores
Expand Down
Binary file modified inst/.DS_Store
Binary file not shown.
14 changes: 9 additions & 5 deletions man/fightin_words_plot.Rd

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

Binary file modified tests/.DS_Store
Binary file not shown.

0 comments on commit 3ed1e41

Please sign in to comment.