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

plot_histogram/plot_density will fail whenever there are spaces in column names #63

Closed
litaxc opened this issue Apr 1, 2018 · 1 comment
Closed

Comments

@litaxc
Copy link

@litaxc litaxc commented Apr 1, 2018

If any of the column name in the dataset contains a white space, plot_histogram and plot_density will fail.
It could be fixed by altering the column names before feeding into the function.

Here's the full error message: Life Ladder is the first column in my dataset appeared containing a white space in it.

Error in parse(text = x): <text>:1:6: unexpected symbol
1: Life Ladder
         ^
Traceback:

1. plot_histogram(whr_2018)
2. lapply(seq_along(subset_data), function(j) {
 .     x <- na.omit(subset_data[, j, with = FALSE])
 .     ggplot(x, aes_string(x = names(x))) + geom_histogram(bins = 30L, 
 .         colour = "black", alpha = 0.4, ...) + scale_x_continuous(labels = comma) + 
 .         scale_y_continuous(labels = comma) + ylab("Frequency")
 . })
3. FUN(X[[i]], ...)
4. ggplot(x, aes_string(x = names(x)))
5. ggplot.data.frame(x, aes_string(x = names(x)))
6. inherits(mapping, "uneval")
7. aes_string(x = names(x))
8. lapply(mapping, function(x) {
 .     if (is.character(x)) {
 .         parse(text = x)[[1]]
 .     }
 .     else {
 .         x
 .     }
 . })
9. FUN(X[[i]], ...)
10. parse(text = x)

I am not very experienced in r functional programming, but I would like to help if there's any I could.

boxuancui added a commit that referenced this issue Apr 2, 2018
@boxuancui boxuancui self-assigned this Apr 2, 2018
@boxuancui boxuancui added this to the 0.6.0 milestone Apr 2, 2018
@boxuancui
Copy link
Owner

@boxuancui boxuancui commented Apr 2, 2018

Thanks for reporting. It is fixed with commit 62a1046. Please install the latest develop branch, e.g., remotes::install_github("boxuancui/DataExplorer", ref = "develop")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.