0

I wrote the Package NetExplorer that creates a html file to visualize a network. The file was created in the user R library folder but this violates the CRAN Policies. I created the file in the TMPDIR whith the following command:

tempdir <- tempfile()
dir.create(tempdir)
tmpFile <- file.path(tempdir, "Net.html")

However, CRAN policies say that such usage should be cleaned up. How could I achieve that as without the created file the network cannot be visualized?

Thank you in advance for your help.

Regards

NelsonGon
  • 13,015
  • 7
  • 27
  • 57
Sosa
  • 141
  • 9
  • Create a temporary environment and store it there? – NelsonGon Dec 04 '21 at 10:36
  • 1
    check packages quantmod or getBatchsymbols. These download data in tmp files in a tmp directory. – phiver Dec 04 '21 at 10:39
  • In getBatchsymbols they save the file but I can't see any clean up: https://github.com/msperlin/BatchGetSymbols/blob/master/R/myGetSymbols.R – Sosa Dec 04 '21 at 10:56
  • In quantmod, file path and clean up are dependent on getSymbolsDB function arguments. I will try this, thank you : https://github.com/joshuaulrich/quantmod/blob/a2aad1693ad9f7f6642bee225e139454a6965750/R/attachSymbols.R – Sosa Dec 04 '21 at 11:02
  • @NelsonGon This is what I am doing but the issue is the cleaning part. Does this need to be done by the function or is it automatic once the R session is closed? – Sosa Dec 04 '21 at 11:04
  • 2
    I think such questions are better asked at https://stat.ethz.ch/mailman/listinfo/r-package-devel – tpetzoldt Dec 04 '21 at 11:18
  • 3
    The cleanup doesn't have to happen in the function, but it needs to happen by the end of the example in the help page. If that's impossible, then in your example, only create the tempfile when running interactively, using `if (interactive()) ...`, or set it as `\donttest{ ... }`. – user2554330 Dec 04 '21 at 12:11

0 Answers0