Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #101 - throw an error if the x argument supplied to vis_dat is not a data.frame #102

Merged
merged 5 commits into from
Nov 28, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions R/vis-dat.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ vis_dat <- function(x,
warn_large_data = TRUE,
large_data_size = 900000) {

if(!("data.frame" %in% class(x))){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perfect! Can I suggest that you use

! inherits(x, "data.frame)

stop("x must be a data.frame object")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps we could add something to the message that tells the person what class they provided to visdat as well, so it says something like:

Oop! You have provided me with , but visdat needs a data.frame, perhaps try ...

What do you think?

}

# add warning for large data
if (ncol(x) * nrow(x) > large_data_size && warn_large_data){
stop("Data exceeds recommended size for visualisation, please consider
Expand Down