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

fast_check.R failing #36

Open
ghost opened this issue Dec 27, 2015 · 5 comments
Open

fast_check.R failing #36

ghost opened this issue Dec 27, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented Dec 27, 2015

I'm new to R, so I do not have a great ability to debug issues yet. After setting up the R environment on Xubuntu and OSX, I keep running into the same issues when running fast_check.R as well as the script for the first chapter.

Checking Chapter 1 - Introduction

`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Error in strsplit(unitspec, " ") : non-character argument
Calls: source ... fullseq.Date -> seq -> floor_date -> parse_unit_spec -> strsplit
In addition: Warning message:
Removed 1 rows containing non-finite values (stat_bin). 
Execution halted

Here's my R version:
R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"

Is there a preferred environment/version for running the sample code, or am I really missing something?

@johnmyleswhite
Copy link
Owner

The current code is out-of-date as R libraries have changed a lot since we released the book. We will try to update it when we have a chance.

@ghost
Copy link
Author

ghost commented Dec 28, 2015

I don't suppose you know versions that the code will run on? Could probably find a way to install old versions in the mean time.

@johnmyleswhite
Copy link
Owner

No, but the code ran correctly when the book was released in February 2012.

@junkor
Copy link

junkor commented Aug 23, 2016

I found if I change the code to :

quick.hist <- ggplot(ufo.us, aes(x = DateReported)) +
  geom_histogram() + scale_x_date(date_breaks = "10 years", date_labels = "%Y") 

I can get a nice plot. (with R version 3.3.1)

@Morgan-Leon
Copy link

Morgan-Leon commented Oct 17, 2017

I have the same issue with R version 3.4.1 (2017-06-30) in x86_64-w64-mingw32 :
Error in strsplit(unitspec, " ") : non-character argument

The problem lies in the ggplot function scale_x_date. In the original code this is coded as:

quick.hist <- ggplot(ufo.us, aes(x = DateOccurred)) +
  geom_histogram() + 
  scale_x_date(breaks = "50 years")

The breaks in scale_x_date has been adjusted to date_breaks. If you adjust the code to the following it works.

quick.hist <- ggplot(ufo.us, aes(x = DateOccurred)) +
  geom_histogram() + 
  scale_x_date(date_breaks = "50 years", date_labels = "%Y")

In the rest of the code where you see ggplot and scale_x_date, you will have to adjust the breaks into date_breaks.

stackoverflow

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

No branches or pull requests

3 participants