GetUnzip: Function to extract csv data from a zipped archive

Description Usage Arguments Value Author(s) References Examples

Description

Code adapted from http://stackoverflow.com/questions/3053833/using-r-to-download-zipped-data-file-extract-and-import-data

Usage

1
GetUnzip(ZipName, FileName)

Arguments

ZipName

name of zipped archive

FileName

FileName: name of file in zipped archive

Value

A data frame (or whatever else read.csv wants to give)

Author(s)

Bob O'Hara

References

http://stackoverflow.com/questions/3053833/using-r-to-download-zipped-data-file-extract-and-import-data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Download woodpecker data from BBS
Rep <- "ftp://ftpext.usgs.gov/pub/er/md/laurel/BBS/DataFiles/"
dat=GetUnzip(ZipName=paste0(Rep, "States/Florida.zip"), 
               FileName="Florida.csv")

## Not run: 
## Download from a local repository
##   Use your own LocalRepos
  LocalRepos <- "~/Dropbox/"
  dat=GetUnzip(ZipName=paste0(LocalRepos, 
               "BBS/DataFiles/Species/TrogWoodp.zip"), 
               FileName="TrogWoodp.csv")

## End(Not run)

oharar/rBBS documentation built on May 24, 2019, 11:55 a.m.