Note that there are some explanatory texts on larger screens.

plurals
  1. POR hdf5 dataset written incorrectly?
    text
    copied!<p>When I execute the following my "predictors" dataset is populated correctly:</p> <pre><code>library(rhdf5) library(forecast) library(sltl) library(tseries) fid &lt;- H5Fcreate(output_file) ## TODO: compute the order p p &lt;- 4 # write predictors h5createDataset(output_file, dataset="predictors", c(p, length(tsstl.remainder) - (p - 1)), storage.mode='double') predictors &lt;- as.matrix(tsstl.remainder) for (i in 1:(p - 1)) { predictors &lt;- as.matrix(cbind(predictors, Lag(as.matrix(tsstl.remainder), i))) } predictors &lt;- as.matrix(predictors[-1:-(p-1),]) head(predictors) h5write(predictors, output_file, name="predictors") H5Fclose(fid) </code></pre> <p>The generated (correct) output for <code>head(predictors)</code> is:</p> <pre><code> [,1] [,2] [,3] [,4] [1,] 0.3089645 6.7722063 5.1895389 5.2323261 [2,] 8.7607228 0.3089645 6.7722063 5.1895389 [3,] -0.9411553 8.7607228 0.3089645 6.7722063 [4,] -14.1390243 -0.9411553 8.7607228 0.3089645 [5,] -26.6605296 -14.1390243 -0.9411553 8.7607228 [6,] -8.1293076 -26.6605296 -14.1390243 -0.9411553 </code></pre> <p>However, when I read it the results are not correct:</p> <pre><code>tsmatrix &lt;- t(as.matrix(h5read(output_file, "predictors"))) head(tsmatrix) </code></pre> <p>Incorrectly outputs:</p> <pre><code> [,1] [,2] [,3] [,4] [1,] 0.3089645 8.760723 -0.9411553 -14.13902 [2,] -26.6605296 -8.129308 -9.8687675 31.52086 [3,] 54.2703126 43.902489 31.8164836 43.87957 [4,] 22.1260636 36.733055 54.7064107 56.35158 [5,] 36.3919851 25.193068 48.2244464 57.12196 [6,] 48.0585673 72.402673 68.3265518 80.18960 </code></pre> <p>How come what I write does not correspond to what I get back? I double-checked and hdfview HDF5 viewer also shows this incorrect values for the "predictors" dataset.</p> <p>What is wrong here?</p>
 

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