Skip to content

Instantly share code, notes, and snippets.

@mribeirodantas
Created March 3, 2020 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mribeirodantas/4cff3ffdb582bd9fcf176afbb91415c7 to your computer and use it in GitHub Desktop.
Save mribeirodantas/4cff3ffdb582bd9fcf176afbb91415c7 to your computer and use it in GitHub Desktop.
# The first thing to do is to bring a copy of the source code to
# your local machine. In git terminology, this is called cloning.
git clone https://github.com/mribeirodantas/r_dvc_git_packrat.git
cd r_dvc_git_packrat
# You can see within this folder that it only contains what git
# tracks, that is, NOT your data. Metadata about your data, but
# not data.
# Next step is to open R. This will trigger packrat to auto install.
R
# Next, you need to do a restore, that is, restore the R packages
# that were in the environment but are not in yours now.
packrat::restore()
# Now, the same way you cloned from git, you need to clone from a
# DVC remote. In my computer, since I have the local remote, I only
# have to do dvc pull. In your case, you need to add the really
# remote remote :-)
dvc remote add newremote https://www.dropbox.com/sh/kjviy4r3la22fj6/AAB43oyVnbx-sNkERJshMxdha
# And then you pull with the new remote
dvc pull -r newremote
# I hosted my remote in Dropbox but you can do it in Amazon S3,
# among other solutions. If someone hosted it somewhere, you
# can also download it and turn it into your local remote.
# First, download it.
wget -c https://www.dropbox.com/sh/kjviy4r3la22fj6/AAB43oyVnbx-sNkERJshMxdha\?dl\=1 --output-document=dvc-storage.zip
# Next, unzip and remove the .zip
unzip dvc-storage.zip -d dvc-storage
rm dvc-storage.zip
# Place this folder (your dvc remote) somewhere else, like in your
# home directory
mv dvc-storage $HOME/
# Set it to be your remote and remove the default one I set
dvc remote remove myremote
dvc remote add mynewremote $HOME/dvc-storage
dvc pull -r mynewremote
# If you do not want to set manually the remote, set this as your
# default
dvc remote default mynewremote
dvc pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment