[R] Error produced by read.zoo: bad entries
Hello! I have a data set similar to the data set monthly in the example below: monthly-data.frame(month=c(20090301,20090401,20090501,20100301,20100401,20090301,20090401,20090501,20100301,20100401),monthly.value=c(100,200,300,101,201,10,20,30,11,21),market=c(Market A,Market A, Market A,Market A, Market A,Market B, Market B,Market B,Market B, Market B)) monthly$month-as.character(monthly$month) monthly$month-as.Date(monthly$month,%Y%m%d) (monthly) str(monthly) I am trying to use read.zoo - like in 3 lines below: library(zoo) z - read.zoo(monthly, split = market) (z) With the artificially produced data set above, it works just fine. However, with my data it gives me an error: OrigData-read.csv(OrigData.csv) OrigData$Month-as.character(OrigData$Month) OrigData$Month-as.Date(OrigData$Month,%m/%d/%y) str(OrigData) ### The result of str(OrigData) is: 'data.frame': 440 obs. of 3 variables: $ Brand : Factor w/ 11 levels aBrand,bBrand,..: Month :Class 'Date' num [1:440] 13514 13545 13573 13604,... Value: int NA NA NA 100 100 100 100 100 100 99 Then I try: z - read.zoo(OrigData, split = Brand) And get the error: Error in read.zoo(OrigData, split = Brand) : index has 440 bad entries at data rows: 1 2 3 4 5 6 7 8 9 10 11 12 13 But the structure of my OrigData is exactly the same as of monthly. OK - OrigData always has a few NAs in Value coming first - but that's consistent for all brands. Any idea what might be wrong? Thanks a lot! Just in case -attaching the actual file. Dimitri __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error produced by read.zoo: bad entries
?read.zoo You didn't specify the index column correctly. On Jul 23, 2010, at 12:36 PM, Dimitri Liakhovitski wrote: Hello! I have a data set similar to the data set monthly in the example below: monthly- data .frame (month = c (20090301,20090401,20090501,20100301,20100401,20090301,20090401,20090501,20100301,20100401 ),monthly.value=c(100,200,300,101,201,10,20,30,11,21),market=c(Market A,Market A, Market A,Market A, Market A,Market B, Market B,Market B,Market B, Market B)) monthly$month-as.character(monthly$month) monthly$month-as.Date(monthly$month,%Y%m%d) (monthly) str(monthly) I am trying to use read.zoo - like in 3 lines below: library(zoo) z - read.zoo(monthly, split = market) (z) With the artificially produced data set above, it works just fine. However, with my data it gives me an error: OrigData-read.csv(OrigData.csv) OrigData$Month-as.character(OrigData$Month) OrigData$Month-as.Date(OrigData$Month,%m/%d/%y) str(OrigData) ### The result of str(OrigData) is: 'data.frame': 440 obs. of 3 variables: $ Brand : Factor w/ 11 levels aBrand,bBrand,..: Month :Class 'Date' num [1:440] 13514 13545 13573 13604,... Value: int NA NA NA 100 100 100 100 100 100 99 ?read.zoo You didn't specify the index column correctly. In this case it needs to be = 2. Then I try: z - read.zoo(OrigData, split = Brand) And get the error: Error in read.zoo(OrigData, split = Brand) : index has 440 bad entries at data rows: 1 2 3 4 5 6 7 8 9 10 11 12 13 But the structure of my OrigData is exactly the same as of monthly. OK - OrigData always has a few NAs in Value coming first - but that's consistent for all brands. Any idea what might be wrong? Thanks a lot! Just in case -attaching the actual file. No. Not attached. -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error produced by read.zoo: bad entries
Strange, I did attach. Attaching again. Maybe the file just doesn't go through? I have: names(OrigData): [1] Brand Month Value I read ?read.zoo According to that index should be the column number. I thought it should be split = 1 in my case - because I am splitting by Brand. But neither split = 1 nor split =2 work. And split =Brand does not work either. Why? D. On Fri, Jul 23, 2010 at 12:52 PM, David Winsemius dwinsem...@comcast.net wrote: ?read.zoo You didn't specify the index column correctly. On Jul 23, 2010, at 12:36 PM, Dimitri Liakhovitski wrote: Hello! I have a data set similar to the data set monthly in the example below: monthly-data.frame(month=c(20090301,20090401,20090501,20100301,20100401,20090301,20090401,20090501,20100301,20100401),monthly.value=c(100,200,300,101,201,10,20,30,11,21),market=c(Market A,Market A, Market A,Market A, Market A,Market B, Market B,Market B,Market B, Market B)) monthly$month-as.character(monthly$month) monthly$month-as.Date(monthly$month,%Y%m%d) (monthly) str(monthly) I am trying to use read.zoo - like in 3 lines below: library(zoo) z - read.zoo(monthly, split = market) (z) With the artificially produced data set above, it works just fine. However, with my data it gives me an error: OrigData-read.csv(OrigData.csv) OrigData$Month-as.character(OrigData$Month) OrigData$Month-as.Date(OrigData$Month,%m/%d/%y) str(OrigData) ### The result of str(OrigData) is: 'data.frame': 440 obs. of 3 variables: $ Brand : Factor w/ 11 levels aBrand,bBrand,..: Month :Class 'Date' num [1:440] 13514 13545 13573 13604,... Value: int NA NA NA 100 100 100 100 100 100 99 ?read.zoo You didn't specify the index column correctly. In this case it needs to be = 2. Then I try: z - read.zoo(OrigData, split = Brand) And get the error: Error in read.zoo(OrigData, split = Brand) : index has 440 bad entries at data rows: 1 2 3 4 5 6 7 8 9 10 11 12 13 But the structure of my OrigData is exactly the same as of monthly. OK - OrigData always has a few NAs in Value coming first - but that's consistent for all brands. Any idea what might be wrong? Thanks a lot! Just in case -attaching the actual file. No. Not attached. -- David Winsemius, MD West Hartford, CT -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error produced by read.zoo: bad entries
But, but, but Did you read my message about the need to correctly specify index columns? The problem is that read.zoo is reading your first column as an index and it's actually the second column that should be used for that purpose. -- David. On Jul 23, 2010, at 1:01 PM, Dimitri Liakhovitski wrote: Strange, I did attach. Attaching again. Maybe the file just doesn't go through? I have: names(OrigData): [1] Brand Month Value I read ?read.zoo According to that index should be the column number. I thought it should be split = 1 in my case - because I am splitting by Brand. But neither split = 1 nor split =2 work. And split =Brand does not work either. Why? D. On Fri, Jul 23, 2010 at 12:52 PM, David Winsemius dwinsem...@comcast.net wrote: ?read.zoo You didn't specify the index column correctly. On Jul 23, 2010, at 12:36 PM, Dimitri Liakhovitski wrote: Hello! I have a data set similar to the data set monthly in the example below: monthly- data .frame (month = c (20090301,20090401,20090501,20100301,20100401,20090301,20090401,20090501,20100301,20100401 ),monthly .value=c(100,200,300,101,201,10,20,30,11,21),market=c(Market A,Market A, Market A,Market A, Market A,Market B, Market B,Market B,Market B, Market B)) monthly$month-as.character(monthly$month) monthly$month-as.Date(monthly$month,%Y%m%d) (monthly) str(monthly) I am trying to use read.zoo - like in 3 lines below: library(zoo) z - read.zoo(monthly, split = market) (z) With the artificially produced data set above, it works just fine. However, with my data it gives me an error: OrigData-read.csv(OrigData.csv) OrigData$Month-as.character(OrigData$Month) OrigData$Month-as.Date(OrigData$Month,%m/%d/%y) str(OrigData) ### The result of str(OrigData) is: 'data.frame': 440 obs. of 3 variables: $ Brand : Factor w/ 11 levels aBrand,bBrand,..: Month :Class 'Date' num [1:440] 13514 13545 13573 13604,... Value: int NA NA NA 100 100 100 100 100 100 99 ?read.zoo You didn't specify the index column correctly. In this case it needs to be = 2. Then I try: z - read.zoo(OrigData, split = Brand) And get the error: Error in read.zoo(OrigData, split = Brand) : index has 440 bad entries at data rows: 1 2 3 4 5 6 7 8 9 10 11 12 13 But the structure of my OrigData is exactly the same as of monthly. OK - OrigData always has a few NAs in Value coming first - but that's consistent for all brands. Any idea what might be wrong? Thanks a lot! Just in case -attaching the actual file. No. Not attached. -- David Winsemius, MD West Hartford, CT -- Dimitri Liakhovitski Ninah Consulting www.ninah.com OrigData.csv David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error produced by read.zoo: bad entries
Very sorry - I mistunderstood and confused split with index.column - totally my fault. Ok, now I've run this line: z - read.zoo(OrigData, index.column = 2, split = Brand) And I am getting: Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) And under warnings() it says: 1: In zoo(rval4[[i]], ix[[i]]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique On Fri, Jul 23, 2010 at 1:13 PM, David Winsemius dwinsem...@comcast.net wrote: But, but, but Did you read my message about the need to correctly specify index columns? The problem is that read.zoo is reading your first column as an index and it's actually the second column that should be used for that purpose. -- David. On Jul 23, 2010, at 1:01 PM, Dimitri Liakhovitski wrote: Strange, I did attach. Attaching again. Maybe the file just doesn't go through? I have: names(OrigData): [1] Brand Month Value I read ?read.zoo According to that index should be the column number. I thought it should be split = 1 in my case - because I am splitting by Brand. But neither split = 1 nor split =2 work. And split =Brand does not work either. Why? D. On Fri, Jul 23, 2010 at 12:52 PM, David Winsemius dwinsem...@comcast.net wrote: ?read.zoo You didn't specify the index column correctly. On Jul 23, 2010, at 12:36 PM, Dimitri Liakhovitski wrote: Hello! I have a data set similar to the data set monthly in the example below: monthly-data.frame(month=c(20090301,20090401,20090501,20100301,20100401,20090301,20090401,20090501,20100301,20100401),monthly.value=c(100,200,300,101,201,10,20,30,11,21),market=c(Market A,Market A, Market A,Market A, Market A,Market B, Market B,Market B,Market B, Market B)) monthly$month-as.character(monthly$month) monthly$month-as.Date(monthly$month,%Y%m%d) (monthly) str(monthly) I am trying to use read.zoo - like in 3 lines below: library(zoo) z - read.zoo(monthly, split = market) (z) With the artificially produced data set above, it works just fine. However, with my data it gives me an error: OrigData-read.csv(OrigData.csv) OrigData$Month-as.character(OrigData$Month) OrigData$Month-as.Date(OrigData$Month,%m/%d/%y) str(OrigData) ### The result of str(OrigData) is: 'data.frame': 440 obs. of 3 variables: $ Brand : Factor w/ 11 levels aBrand,bBrand,..: Month :Class 'Date' num [1:440] 13514 13545 13573 13604,... Value: int NA NA NA 100 100 100 100 100 100 99 ?read.zoo You didn't specify the index column correctly. In this case it needs to be = 2. Then I try: z - read.zoo(OrigData, split = Brand) And get the error: Error in read.zoo(OrigData, split = Brand) : index has 440 bad entries at data rows: 1 2 3 4 5 6 7 8 9 10 11 12 13 But the structure of my OrigData is exactly the same as of monthly. OK - OrigData always has a few NAs in Value coming first - but that's consistent for all brands. Any idea what might be wrong? Thanks a lot! Just in case -attaching the actual file. No. Not attached. -- David Winsemius, MD West Hartford, CT -- Dimitri Liakhovitski Ninah Consulting www.ninah.com OrigData.csv David Winsemius, MD West Hartford, CT -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error produced by read.zoo: bad entries
On Jul 23, 2010, at 1:39 PM, Dimitri Liakhovitski wrote: Very sorry - I mistunderstood and confused split with index.column - totally my fault. Ok, now I've run this line: z - read.zoo(OrigData, index.column = 2, split = Brand) And I am getting: Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) I got the warnings but no error: z - read.zoo(OrigData, split = Brand, index.column=2) There were 11 warnings (use warnings() to see them) z Plus agrow chool gress Grib inKid kid omis plet pro romil [1,]NANANANA NANA NA NA NA NANA [2,]98999897 9696 100 97 97 9996 [3,]95 1009799 9297 100 97 99 10099 [4,]97999498 9195 99 98 98 9995 [5,]NANANANA NANA NA NA NA NANA [6,]98999897 9396 99 97 98 9996 [7,]97 1009898 9596 99 98 98 10097 [8,]98999499 9696 99 98 98 9997 [9,]NANANANA NANA NA NA NA NANA [10,]98999898 9596 99 98 98 9997 [11,]98999899 9796 99 98 97 9999 [12,]97 1009699 9595 99 99 97 10096 [13,]96 1009696 93 0 100 96 97 10096 [14,]989998 100 9496 100 98 97 9999 [15,]95 1009899 9395 99 99 99 9999 [16,]97999699 9495 98 98 90 9995 [17,]97 1009796 92 0 100 96 98 10095 [18,]96999898 9697 100 98 99 9898 [19,]98 1009898 9697 99 98 99 9998 [20,]98 1009796 95 0 100 96 98 9996 [21,]94 1009899 9297 99 98 98 9898 [22,]98999897 9696 99 97 98 9997 [23,]97 1009696 93 0 100 95 97 10095 [24,]97 1009897 9396 99 97 98 9795 [25,]98 1009697 9694 100 97 99 9996 [26,]98 1009896 95 0 100 96 98 9995 [27,]98 1009897 9396 96 97 98 9999 [28,]99 1009898 9296 100 98 99 9997 [29,]98 1009795 95 0 100 95 98 9995 [30,]99 10098 100 9898 99 100 99 10099 [31,]97999497 9595 99 97 98 9894 [32,]98999896 95 3 100 96 97 9996 [33,]97999899 9797 99 99 99 9999 [34,]96999596 9494 98 96 96 9893 [35,]98999897 9454 100 97 97 9996 [36,]95 1009799 9595 99 99 98 10099 [37,]98999898 9596 99 98 99 9997 [38,]98999897 9694 100 97 97 9896 [39,]95 10098 100 9597 100 99 99 10099 [40,]97 1009598 9396 99 98 98 9996 Since you didn't say what was expected, I am not in a position to know if this is success. And under warnings() it says: 1: In zoo(rval4[[i]], ix[[i]]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique On Fri, Jul 23, 2010 at 1:13 PM, David Winsemius dwinsem...@comcast.net wrote: But, but, but Did you read my message about the need to correctly specify index columns? The problem is that read.zoo is reading your first column as an index and it's actually the second column that should be used for that purpose. -- David. On Jul 23, 2010, at 1:01 PM, Dimitri Liakhovitski wrote: Strange, I did attach. Attaching again. Maybe the file just doesn't go through? I have: names(OrigData): [1] Brand Month Value I read ?read.zoo According to that index should be the column number. I thought it should be split = 1 in my case - because I am splitting by Brand. But neither split = 1 nor split =2 work. And split =Brand does not work either. Why? D. On Fri, Jul 23, 2010 at 12:52 PM, David Winsemius dwinsem...@comcast.net wrote: ?read.zoo You didn't specify the index column correctly. On Jul 23, 2010, at 12:36 PM, Dimitri Liakhovitski wrote: Hello! I have a data set similar to the data set monthly in the example below: monthly- data .frame (month = c (20090301,20090401,20090501,20100301,20100401,20090301,20090401,20090501,20100301,20100401 ),monthly .value=c(100,200,300,101,201,10,20,30,11,21),market=c(Market A,Market A, Market A,Market A, Market A,Market B, Market B,Market B,Market B, Market B)) monthly$month-as.character(monthly$month) monthly$month-as.Date(monthly$month,%Y%m%d) (monthly) str(monthly) I am trying
Re: [R] Error produced by read.zoo: bad entries
I am expecting to see the week names as row labels of z and the corresponding values (like in the monthly example). I am pretty sure - in order to get it one needs to install the latest version of zoo. I've done it just a couple of days ago. I am getting the error - and nothing is produced. Can it have to do with the fact that I am using the newer version of zoo? Again, my full code for that OrigData.csv file I sent is: OrigData-read.csv(OrigData.csv) OrigData$Month-as.character(OrigData$Month) OrigData$Month-as.Date(OrigData$Month,%m/%d/%y) str(OrigData) 'data.frame': 440 obs. of 3 variables: $ Brand: Factor w/ 11 levels Plus,agrow,..: 2 2 2 2 2 2 2 2 2 2 ... $ Month:Class 'Date' num [1:440] 18262 18293 18322 18353 18383 ... $ Value: int NA NA NA 100 100 100 100 100 100 99 ... library(zoo) z - read.zoo(OrigData, index.column = 2, split = Brand) Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) warnings() Warning messages: 1: In zoo(rval4[[i]], ix[[i]]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 2: In zoo(rval4[[i]], ix[[i]]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 3: In zoo(rval4[[i]], ix[[i]]) : etc. But it does not give me this error for my Monthly example - even when I introduce a few NAs there. And I get this message: Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) On Fri, Jul 23, 2010 at 1:41 PM, David Winsemius dwinsem...@comcast.net wrote: On Jul 23, 2010, at 1:39 PM, Dimitri Liakhovitski wrote: Very sorry - I mistunderstood and confused split with index.column - totally my fault. Ok, now I've run this line: z - read.zoo(OrigData, index.column = 2, split = Brand) And I am getting: Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) I got the warnings but no error: z - read.zoo(OrigData, split = Brand, index.column=2) There were 11 warnings (use warnings() to see them) z Plus agrow chool gress Grib inKid kid omis plet pro romil [1,] NA NA NA NA NA NA NA NA NA NA NA [2,] 98 99 98 97 96 96 100 97 97 99 96 [3,] 95 100 97 99 92 97 100 97 99 100 99 [4,] 97 99 94 98 91 95 99 98 98 99 95 [5,] NA NA NA NA NA NA NA NA NA NA NA [6,] 98 99 98 97 93 96 99 97 98 99 96 [7,] 97 100 98 98 95 96 99 98 98 100 97 [8,] 98 99 94 99 96 96 99 98 98 99 97 [9,] NA NA NA NA NA NA NA NA NA NA NA [10,] 98 99 98 98 95 96 99 98 98 99 97 [11,] 98 99 98 99 97 96 99 98 97 99 99 [12,] 97 100 96 99 95 95 99 99 97 100 96 [13,] 96 100 96 96 93 0 100 96 97 100 96 [14,] 98 99 98 100 94 96 100 98 97 99 99 [15,] 95 100 98 99 93 95 99 99 99 99 99 [16,] 97 99 96 99 94 95 98 98 90 99 95 [17,] 97 100 97 96 92 0 100 96 98 100 95 [18,] 96 99 98 98 96 97 100 98 99 98 98 [19,] 98 100 98 98 96 97 99 98 99 99 98 [20,] 98 100 97 96 95 0 100 96 98 99 96 [21,] 94 100 98 99 92 97 99 98 98 98 98 [22,] 98 99 98 97 96 96 99 97 98 99 97 [23,] 97 100 96 96 93 0 100 95 97 100 95 [24,] 97 100 98 97 93 96 99 97 98 97 95 [25,] 98 100 96 97 96 94 100 97 99 99 96 [26,] 98 100 98 96 95 0 100 96 98 99 95 [27,] 98 100 98 97 93 96 96 97 98 99 99 [28,] 99 100 98 98 92 96 100 98 99 99 97 [29,] 98 100 97 95 95 0 100 95 98 99 95 [30,] 99 100 98 100 98 98 99 100 99 100 99 [31,] 97 99 94 97 95 95 99 97 98 98 94 [32,] 98 99 98 96 95 3 100 96 97 99 96 [33,] 97 99 98 99 97 97 99 99 99 99 99 [34,] 96 99 95 96 94 94 98 96 96 98 93 [35,] 98 99 98 97 94 54 100 97 97 99 96 [36,] 95 100 97 99 95 95 99 99 98 100 99 [37,] 98 99 98 98 95 96 99 98 99 99 97 [38,] 98 99 98 97 96 94 100 97 97
Re: [R] Error produced by read.zoo: bad entries
On Fri, Jul 23, 2010 at 1:39 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Very sorry - I mistunderstood and confused split with index.column - totally my fault. Ok, now I've run this line: z - read.zoo(OrigData, index.column = 2, split = Brand) And I am getting: Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) And under warnings() it says: 1: In zoo(rval4[[i]], ix[[i]]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique There may be something wrong with the data. The warning is an alert to the fact that we have at least one brand for which there are duplicate dates. One would have expected that dates are unique within brand (or if its ok to have duplicate dates within brand then they should be aggregated as they are read them in using the aggregate= argument of read.zoo) . __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error produced by read.zoo: bad entries
On Jul 23, 2010, at 1:50 PM, Dimitri Liakhovitski wrote: I am expecting to see the week names as row labels of z and the corresponding values (like in the monthly example). I am pretty sure - in order to get it one needs to install the latest version of zoo. I've done it just a couple of days ago. I am getting the error - and nothing is produced. Can it have to do with the fact that I am using the newer version of zoo? Again, my full code for that OrigData.csv file I sent is: Yep, updating to the current version of zoo on CRAN, zoo_1.6-4, now produces an error where before with the penultimate version, zoo_1.6-3, it did not. -- David. OrigData-read.csv(OrigData.csv) OrigData$Month-as.character(OrigData$Month) OrigData$Month-as.Date(OrigData$Month,%m/%d/%y) str(OrigData) 'data.frame': 440 obs. of 3 variables: $ Brand: Factor w/ 11 levels Plus,agrow,..: 2 2 2 2 2 2 2 2 2 2 ... $ Month:Class 'Date' num [1:440] 18262 18293 18322 18353 18383 ... $ Value: int NA NA NA 100 100 100 100 100 100 99 ... library(zoo) z - read.zoo(OrigData, index.column = 2, split = Brand) Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) warnings() Warning messages: 1: In zoo(rval4[[i]], ix[[i]]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 2: In zoo(rval4[[i]], ix[[i]]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 3: In zoo(rval4[[i]], ix[[i]]) : etc. But it does not give me this error for my Monthly example - even when I introduce a few NAs there. And I get this message: Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) On Fri, Jul 23, 2010 at 1:41 PM, David Winsemius dwinsem...@comcast.net wrote: On Jul 23, 2010, at 1:39 PM, Dimitri Liakhovitski wrote: Very sorry - I mistunderstood and confused split with index.column - totally my fault. Ok, now I've run this line: z - read.zoo(OrigData, index.column = 2, split = Brand) And I am getting: Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) I got the warnings but no error: z - read.zoo(OrigData, split = Brand, index.column=2) There were 11 warnings (use warnings() to see them) z Plus agrow chool gress Grib inKid kid omis plet pro romil [1,]NANANANA NANA NA NA NA NANA [2,]98999897 9696 100 97 97 9996 [3,]95 1009799 9297 100 97 99 10099 [4,]97999498 9195 99 98 98 9995 [5,]NANANANA NANA NA NA NA NANA [6,]98999897 9396 99 97 98 9996 [7,]97 1009898 9596 99 98 98 10097 [8,]98999499 9696 99 98 98 9997 [9,]NANANANA NANA NA NA NA NANA [10,]98999898 9596 99 98 98 9997 [11,]98999899 9796 99 98 97 9999 [12,]97 1009699 9595 99 99 97 10096 [13,]96 1009696 93 0 100 96 97 10096 [14,]989998 100 9496 100 98 97 9999 [15,]95 1009899 9395 99 99 99 9999 [16,]97999699 9495 98 98 90 9995 [17,]97 1009796 92 0 100 96 98 10095 [18,]96999898 9697 100 98 99 9898 [19,]98 1009898 9697 99 98 99 9998 [20,]98 1009796 95 0 100 96 98 9996 [21,]94 1009899 9297 99 98 98 9898 [22,]98999897 9696 99 97 98 9997 [23,]97 1009696 93 0 100 95 97 10095 [24,]97 1009897 9396 99 97 98 9795 [25,]98 1009697 9694 100 97 99 9996 [26,]98 1009896 95 0 100 96 98 9995 [27,]98 1009897 9396 96 97 98 9999 [28,]99 1009898 9296 100 98 99 9997 [29,]98 1009795 95 0 100 95 98 9995 [30,]99 10098 100 9898 99 100 99 10099 [31,]97999497 9595 99 97 98 9894 [32,]98999896 95 3 100 96 97 9996 [33,]97999899 9797 99 99 99 9999 [34,]96999596 9494 98 96 96 9893 [35,]98999897 9454 100 97 97
Re: [R] Error produced by read.zoo: bad entries
David/Gabor, you helped me a lot. Gabor - I've run table(OrigData$Month) - and it looked weird. I went back to my file and changed the format of the date (Month) in Excel. I have no idea what it does - but after I saved it again, it worked. Thanks a lot! I'll open another thread where I'll ask how to best save dates in Excel if one saves them as .csv. Dimitri On Fri, Jul 23, 2010 at 2:00 PM, David Winsemius dwinsem...@comcast.net wrote: On Jul 23, 2010, at 1:50 PM, Dimitri Liakhovitski wrote: I am expecting to see the week names as row labels of z and the corresponding values (like in the monthly example). I am pretty sure - in order to get it one needs to install the latest version of zoo. I've done it just a couple of days ago. I am getting the error - and nothing is produced. Can it have to do with the fact that I am using the newer version of zoo? Again, my full code for that OrigData.csv file I sent is: Yep, updating to the current version of zoo on CRAN, zoo_1.6-4, now produces an error where before with the penultimate version, zoo_1.6-3, it did not. -- David. OrigData-read.csv(OrigData.csv) OrigData$Month-as.character(OrigData$Month) OrigData$Month-as.Date(OrigData$Month,%m/%d/%y) str(OrigData) 'data.frame': 440 obs. of 3 variables: $ Brand: Factor w/ 11 levels Plus,agrow,..: 2 2 2 2 2 2 2 2 2 2 ... $ Month:Class 'Date' num [1:440] 18262 18293 18322 18353 18383 ... $ Value: int NA NA NA 100 100 100 100 100 100 99 ... library(zoo) z - read.zoo(OrigData, index.column = 2, split = Brand) Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) warnings() Warning messages: 1: In zoo(rval4[[i]], ix[[i]]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 2: In zoo(rval4[[i]], ix[[i]]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 3: In zoo(rval4[[i]], ix[[i]]) : etc. But it does not give me this error for my Monthly example - even when I introduce a few NAs there. And I get this message: Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) On Fri, Jul 23, 2010 at 1:41 PM, David Winsemius dwinsem...@comcast.net wrote: On Jul 23, 2010, at 1:39 PM, Dimitri Liakhovitski wrote: Very sorry - I mistunderstood and confused split with index.column - totally my fault. Ok, now I've run this line: z - read.zoo(OrigData, index.column = 2, split = Brand) And I am getting: Error in merge.zoo(` Plus` = c(NA, 98L, 95L, 97L, NA, 98L, 97L, 98L, NA, : series cannot be merged with non-unique index entries in a series In addition: There were 11 warnings (use warnings() to see them) I got the warnings but no error: z - read.zoo(OrigData, split = Brand, index.column=2) There were 11 warnings (use warnings() to see them) z Plus agrow chool gress Grib inKid kid omis plet pro romil [1,] NA NA NA NA NA NA NA NA NA NA NA [2,] 98 99 98 97 96 96 100 97 97 99 96 [3,] 95 100 97 99 92 97 100 97 99 100 99 [4,] 97 99 94 98 91 95 99 98 98 99 95 [5,] NA NA NA NA NA NA NA NA NA NA NA [6,] 98 99 98 97 93 96 99 97 98 99 96 [7,] 97 100 98 98 95 96 99 98 98 100 97 [8,] 98 99 94 99 96 96 99 98 98 99 97 [9,] NA NA NA NA NA NA NA NA NA NA NA [10,] 98 99 98 98 95 96 99 98 98 99 97 [11,] 98 99 98 99 97 96 99 98 97 99 99 [12,] 97 100 96 99 95 95 99 99 97 100 96 [13,] 96 100 96 96 93 0 100 96 97 100 96 [14,] 98 99 98 100 94 96 100 98 97 99 99 [15,] 95 100 98 99 93 95 99 99 99 99 99 [16,] 97 99 96 99 94 95 98 98 90 99 95 [17,] 97 100 97 96 92 0 100 96 98 100 95 [18,] 96 99 98 98 96 97 100 98 99 98 98 [19,] 98 100 98 98 96 97 99 98 99 99 98 [20,] 98 100 97 96 95 0 100 96 98 99 96 [21,] 94 100 98 99 92 97 99 98 98 98 98 [22,] 98 99 98 97 96 96 99 97 98 99 97 [23,] 97 100 96 96 93 0 100 95 97 100 95 [24,] 97 100 98 97 93 96 99 97 98 97 95 [25,] 98 100 96 97 96 94 100 97 99 99 96 [26,] 98 100 98 96 95 0 100 96 98 99 95 [27,] 98 100 98 97 93 96 96 97 98 99 99 [28,]
Re: [R] Error produced by read.zoo: bad entries
On Fri, Jul 23, 2010 at 2:07 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: David/Gabor, you helped me a lot. Gabor - I've run table(OrigData$Month) - and it looked weird. I went back to my file and changed the format of the date (Month) in Excel. I have no idea what it does - but after I saved it again, it worked. Thanks a lot! I'll open another thread where I'll ask how to best save dates in Excel if one saves them as .csv. Dimitri Try out the various packages listed on this page: http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows which directly read Excel files. Hopefully at least one of these packages will be able to handle the dates independently of the format you use for them. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.