Note that there are some explanatory texts on larger screens.

plurals
  1. POR/zoo: index entries in ‘order.by’ are not unique
    primarykey
    data
    text
    <p>I have a .csv file containing 4 columns of data against a column of dates/times at one-minute intervals. Some timestamps are missing, so I'm trying to generate the missing dates/times and assign them NA values in the Y columns. I have previously done this with other .csv files with exactly the same formatting, with no issues. The code is:</p> <pre><code># read the csv file har10 = read.csv(fpath, header=TRUE); # set date har10$HAR.TS&lt;-as.POSIXct(har10$HAR.TS,format="%y/%m/%d %H:%M") # convert to zoo df1.zoo&lt;-zoo(har10[,-1],har10[,1]) #set date to Index # merge and generate NAs df2 &lt;- merge(df1.zoo,zoo(,seq(start(df1.zoo),end(df1.zoo),by="min")), all=TRUE) # write zoo object to .csv file in Home directory write.zoo(df2, file = "har10fixed.csv", sep = ",") </code></pre> <p>My data looks like this (for an entire year, more or less) after conversion to POSIXct, which seems to go fine:</p> <pre><code> HAR.TS C1 C2 C3 C4 1 2010-01-01 00:00:00 -4390.659 5042.423 -2241.6344 -2368.762 2 2010-01-01 00:01:00 -4391.711 5042.056 -2241.1796 -2366.725 3 2010-01-01 00:02:00 -4390.354 5043.003 -2242.5493 -2368.786 4 2010-01-01 00:03:00 -4390.337 5038.570 -2242.7653 -2371.289 </code></pre> <p>When I the "convert to zoo" step I get the following error:</p> <pre><code> Warning message: In zoo(har10[, -1], har10[, 1]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique </code></pre> <p>I have checked for duplicated entries but get no results:</p> <pre><code>&gt; anyDuplicated(har10) [1] 0 </code></pre> <p>Any ideas? I have no idea why I'm getting this error on this file, but it has worked for previous ones. Thanks!</p> <hr> <p>EDIT: Reproducable form:</p> <p>EDIT 2: Have to remove the data/code, sorry!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload