boettiger-lab / gpdd

:package: for the Global Population Dynamics Database
BSD 2-Clause "Simplified" License
1 stars 2 forks source link

Add Vignettes #4

Open cboettig opened 6 years ago

cboettig commented 6 years ago

http://r-pkgs.had.co.nz/vignettes.html

AlexLi0104 commented 5 years ago

@cboettig

Greetings! Sorry that I had my first wave of midterms last week, and I haven't made changes to the gpdd.R yet. I notice that branches from Amy and Brian are merged, and gpdd.R has also been changed. I think the current version still directly reads the .csv files, but doesn't save the dataset, and doesn't have load or onLoad functions.

I wonder if I should keep the current version or make further changes. I could upload the one that saves and loads the datasets, but I haven't found any detailed documentation about writing the onLoad function. Would you mind sending me some references about this, if there is any?

Thank you very much! And definitely let me know if there're other things that I should work on.

cboettig commented 5 years ago

Hey Alex,

We're working out a prototype for this approach with my other URAP student, so his repository is a good reference: https://github.com/kshtzgupta1/ramlegacy

We're opting for .onAttach instead of onLoad, he doesn't quite have this implemented yet either, but it is worth looking at his examples for the downloading and reading in.

The basic idea is that onAttach() will automatically attach the data if it is already been downloaded (to the directory given by rappdirs, see the rappdirs package for more) when the user calls library(gpdd). Otherwise it will prompt the user to download the data, caching the download to that directory.

AlexLi0104 commented 5 years ago

@cboettig

Great! I'll take a look at it and see if I could figure something out.

Thank you!