[R] Wrong output due to what I think might be a data type issue (zoo read in problem)
knavero
knavero at gmail.com
Tue Mar 20 05:34:35 CET 2012
Here's the small scale version of the R script:
http://pastebin.com/sEYKv2Vv
Here's the file that I'm reading in:
http://r.789695.n4.nabble.com/file/n4487682/weatherData.txt weatherData.txt
I apologize for the length of the data. I tried to cut it down to 12 lines,
however, it wasn't reproducing the bad output that I wanted to show.
The problem is that my whole data set shifts down. For example, I have this
when the raw data is read in or scanned in as a zoo object:
"> rawData
(12/01/10 00:53:00) (12/01/10 01:53:00) (12/01/10 02:53:00) (12/01/10
03:53:00)
41 40 39
38
(12/01/10 04:53:00) (12/01/10 05:53:00) (12/01/10 06:53:00) (12/01/10
07:53:00)
38 37 36
39
(12/01/10 08:53:00) (12/01/10 09:53:00) (12/01/10 10:53:00) (12/01/10
11:53:00)
43 47 50 "
Then when I run it through my code, which should feed out the exact same
thing (the values at least), the output is this:
"> intData
(12/01/10 00:53:00) (12/01/10 01:53:00) (12/01/10 02:53:00) (12/01/10
03:53:00)
11.0 10.0 9.0
8.0
(12/01/10 04:53:00) (12/01/10 05:53:00) (12/01/10 06:53:00) (12/01/10
07:53:00)
8.0 7.0 6.0
9.0
(12/01/10 08:53:00) (12/01/10 09:53:00) (12/01/10 10:53:00) (12/01/10
11:53:00)
13.0 17.0 20.0
24.0 "
Finally, my dput(rawData) and dput(intData):
"> dput(rawData)
structure(c(11L, 10L, 9L, 8L, 8L, 7L, 6L, 9L, 13L, 17L, 20L,
24L, 27L, 27L, 27L, 26L, 23L, 21L, 20L, 21L, 18L, 16L, 14L, 14L,
12L, 10L, 12L, 11L, 10L, 10L, 11L, 14L, 16L, 20L, 23L, 27L, 25L,
26L, 29L, 28L, 27L, 26L, 24L, 24L, 25L, 24L, 23L, 23L, 21L, 20L,
18L, 19L, 18L, 18L, 16L, 18L, 21L, 24L, 25L, 27L, 27L, 29L, 29L,..."
"> dput(intData)
structure(c(11, 10, 9, 8, 8, 7, 6, 9, 13, 17, 20, 24, 27, 27,
27, 26, 23, 21, 20, 21, 18, 16, 14, 14, 12, 10, 12, 11, 10, 10,
11, 14, 16, 20, 23, 27, 25, 26, 29, 28, 27, 26, 24, 24, 25, 24,
23, 23, 21, 20, 18, 19, 18, 18, 16, 18, 21, 24, 25, 27, 27, 29,
29, 28, 26, 25, 24, 22, 22, 22, 21, 21, 21, 20, 21, 21, 20, 21,..."
I am not sure how to interpret this, however I have tried researching on
what the "L" following the number is, and it seems they are "list" values?
Also, I have read ?colClasses in the R manual, and have tried colClasses.
>From experience using C, there seems to be a related error message saying:
"scan() expected 'a real', got 'M'"
What is "M"? Is that matrix? Any clarification of the issue and solution is
appreciated. I apologize in advance for any noob mistake related to asking
questions correctly according to forum specifications. Thanks for any help!
I will keep messing around with colClasses....I feel like I am close to a
solution..however, am very far from understanding the problem.
--
View this message in context: http://r.789695.n4.nabble.com/Wrong-output-due-to-what-I-think-might-be-a-data-type-issue-zoo-read-in-problem-tp4487682p4487682.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list