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

filter out malformed date data of ufo #39

Open
kaiwang0112006 opened this issue Apr 4, 2016 · 0 comments
Open

filter out malformed date data of ufo #39

kaiwang0112006 opened this issue Apr 4, 2016 · 0 comments

Comments

@kaiwang0112006
Copy link

It's about the first chapter that you use string length of 8 to deal with malformed date data. After using string length to filter out malformed data, I found "19940000" in DateOccurred and it will be transformed to "NA" by using "ufo$DateOccurred<-as.Date(ufo$DateOccurred, format="%Y%m%d")" after converting date strings. Isn't it also malformed data? And I also found that the way R read the input has an error: like the line 756:

19950704 19950706 Orlando, FL 4-5 min I would like toreport three yellow oval lights which passed over Orlando,Florida on July 4, 1995 at aproximately 21:30 (9:30 pm). These were the sizeof Venus (which they passed close by). Two of them traveled one after the otherat exactly the same speed and path heading south-southeast. The third oneappeared about a minute later following the same path as the other two. Thewhole sighting lasted about 4-5 minute. There were 4 other witnesses oldenough to report the sighting. My 4 year old and 5 year old children were theones who called my attention to the "moving stars". These objects moved fasterthan an airplane and did not resemble anaircraft, and were moving much slowerthan a shooting star. As for them being fireworks, their path was too regularand coordinated. If anybody else saw this phenomenon, please contact me at: [email protected]

After reading in by the function in the book:

> ufo <- read.delim(file.path("data", "ufo", "ufo_awesome.tsv"),
+                   sep = "\t",
+                   stringsAsFactors = FALSE,
+                   header = FALSE,
+                   na.strings = "")

it's separated into two lines:

> ufo[756,]
                      V1   V2   V3   V4   V5   V6
756 [email protected] <NA> <NA> <NA> <NA> <NA>
> ufo[755,]
          V1       V2           V3   V4      V5
755 19950704 19950706  Orlando, FL <NA> 4-5 min
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   V6
755 I would like to report three yellow oval lights which passed over Orlando,Florida on July 4,     1995 at aproximately 21:30 (9:30 pm). These were the sizeof Venus (which they passed close by).     Two of them traveled one after the otherat exactly the same speed and path heading south-    southeast. The third oneappeared about a minute later following the same path as the other two.     Thewhole sighting lasted about 4-5 minutes. There were 4 other witnesses oldenough to report the     sighting. My 4 year old and 5 year old children were theones who called my attention to the     &quot;moving stars&quot;. These objects moved fasterthan an airplane and did not resemble an     aircraft, and were moving much slowerthan a shooting star. As for them being fireworks, their path     was too regularand coordinated. If anybody else saw this phenomenon, please contact me at:
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

1 participant