TODO.md

  1. TEST SUITE - create
  2. We have example rda files
  3. we can use toc() and lload() for each and then compare the results.

    • when getting the element from the toc(), make certain to unclass to avoid [[.RDAToc
    • but can also compare the results by getting the object.
  4. toc( "inst/sampleRDA/utilsNamespace.rda")

  5. Error for toc( "inst/sampleRDA/NULL.rda")

Error in names(ans)[name] = tag : 
  'names' attribute [1] must be the same length as the vector [0]
rdas = list.files("../inst/sampleRDA", pattern = "\\.rda", full = TRUE)
tmp = structure(lapply(rdas, function(x) try(toc(x))), names = rdas)
err = sapply(tmp, inherits, 'try-error')
table(err)

tt = table(unlist(lapply(tmp[!err], function(x) as.data.frame(x)$type)))
setdiff(names(RDAInfo:::SEXPMap), names(tt))
sexp type = 2 depth = 0 hastag = 1 hasattr = 0
sexp type = 1 depth = 1 hastag = 0 hasattr = 0
sexp type = 9 depth = 2 hastag = 0 hasattr = 0
sexp type = 238 depth = 1 hastag = 0 hasattr = 0
sexp type = 2 depth = 2 hastag = 0 hasattr = 0
sexp type = 1 depth = 3 hastag = 0 hasattr = 0
sexp type = 9 depth = 4 hastag = 0 hasattr = 0
sexp type = 2 depth = 2 hastag = 0 hasattr = 0
sexp type = 1 depth = 3 hastag = 0 hasattr = 0
sexp type = 9 depth = 4 hastag = 0 hasattr = 0
sexp type = 2 depth = 2 hastag = 0 hasattr = 0
sexp type = 13 depth = 3 hastag = 0 hasattr = 0
sexp type = 254 depth = 2 hastag = 0 hasattr = 0
sexp type = 2 depth = 2 hastag = 0 hasattr = 0
sexp type = 16 depth = 3 hastag = 0 hasattr = 0
sexp type = 9 depth = 4 hastag = 0 hasattr = 0
   ....  repeated for 264 elements
sexp type = 13 depth = 2 hastag = 0 hasattr = 0            <<<<<<<<<<<<<<<<
sexp type = 2 depth = 2 hastag = 1 hasattr = 0             <<<<<<<<<<<<<<<<
sexp type = 1 depth = 3 hastag = 0 hasattr = 0
sexp type = 9 depth = 4 hastag = 0 hasattr = 0
sexp type = 16 depth = 3 hastag = 0 hasattr = 0

In the R code, this last entry does not have a tag. The value is simply 2. So reading the next entry goes wrong. This is the start of the readPairList

f = "inst/sampleRDA/class_named_integer_logical_character_uncompress.rda"
info = toc(f)
sapply(info, function(x) x$offset)
sapply(unclass(info), function(x) x$offset) # works

Problem Files

11: readRDA.R#39: readExternalPointer(con, elInfo, skipValue, hdr, de
12: readRDA.R#688: ReadItem(con, skipValue, hdr, depth + 1)
13: readRDA.R#39: readREFSXP(con, ty, hdr)
14: readRDA.R#751: get(as.character(ref - 1), hdr$references)

Extra Information

Performance

Check

Verify

o = toc("inst/sampleRDA/list.rda")

Validate Package Code

Done (?)

  1. √ Do we handle NAs in character vectors.

    • Written as -1 and no value, so the length is -1 and we don't read
  2. √ name for object in simpleFunction.rda Seems to be 1, not simpleFun.

    • This is how it is printing when there is only one object. Fix when combine all the columns.
      • simpleFun is the name of the element from toc().
      • print.RDAToc is putting a rowname of 1, nothing to do with the 1 in the body of the function.
  3. √ References for ENVSXP.

  4. √ make [.RDAToc open the file once, read the objects in order of smallest offset and jump to the next amount.

    • See [.RDAToc and readVariables()
  5. √ When read the entire file in toc mode, then access an object, the second read/pass will add references that are already in the references.

  6. They don't do any harm, but are unnecessary.
    • the second "pass" still uses the original indices so finds the original insertions not the new ones.
  7. perhaps toc() "locks" the environment as it knows it has done a pass over the entire file

    • addRef() would check for this lock add not add new references
  8. √ Registering each symsxp twice. and in pairs, i.e., not interspersed by others.

  9. solved - readSYMSXP() was calling readTag() and then registering the result. But readTag() was also registering the result.

  10. √ combine the data.frames when printing.

  11. √ Implement [[ integer for RDAToc.

  12. √ Fix putting formals() on the function in readFunction when not skipping value.



duncantl/RDAInfo documentation built on Aug. 10, 2024, 3:17 p.m.