Closed slyrus closed 2 years ago
I see the following error parsing one of my pzfx files:
> pzfx::read_pzfx(ap_data_pzfx_file, "FOO", strike_action = "exclude") Error in names(x) <- value : 'names' attribute [3] must be the same length as the vector [1] > traceback() 4: `colnames<-`(`*tmp*`, value = col_names) 3: FUN(X[[i]], ...) 2: lapply(col_lst, function(c) { while (nrow(c) < max_len) { col_names <- colnames(c) c <- rbind(c, NA) colnames(c) <- col_names } c }) 1: pzfx::read_pzfx(ap_data_pzfx_file, "FOO", strike_action = "exclude")
I notice that the offending regions of my file have the following XML:
<YColumn Width="162" Decimals="3" Subcolumns="3"> <Subcolumn></Subcolumn> <Subcolumn></Subcolumn> <Subcolumn></Subcolumn> </YColumn> <YColumn Width="162" Decimals="3" Subcolumns="3"> <Subcolumn></Subcolumn> <Subcolumn></Subcolumn> <Subcolumn></Subcolumn> </YColumn> <YColumn Width="162" Decimals="3" Subcolumns="3"> <Subcolumn></Subcolumn> <Subcolumn></Subcolumn> <Subcolumn></Subcolumn> </YColumn> <YColumn Width="162" Decimals="3" Subcolumns="3"> <Subcolumn></Subcolumn> <Subcolumn></Subcolumn> <Subcolumn></Subcolumn> </YColumn>
If I delete these empty YColumn entries, the file parses fine.
Thanks for reporting, i think it's a bug introduced by not handling multiple empty sub columns carefully. Should be fixed in the current master branch - please feel free to reopen if not.
I see the following error parsing one of my pzfx files:
I notice that the offending regions of my file have the following XML:
If I delete these empty YColumn entries, the file parses fine.