Learn R Programming

CHCN (version 1.5)

getEmptyCsv: A function to check for empty Csv files

Description

Before creating inventories or datasets the EnvCanada directory should be checked for completeness. Sometimes the scraping process will result in empty csv files. This function checks for empty files and returns a set of indices for re-scraping the empty files

Usage

getEmptyCsv(directory = "EnvCanada", Monthly = MONTHLY.STATION.LIST)

Arguments

directory
The directory where the csv files live
Monthly
The name of the cvs file with the list of stations that report monthly

Value

Details

The function uses file.info and list.files to find csv files with zero size. Then it seatches the list of monthly stations to find the index (1-7676) of that station Id and returns the set of indices for files that have zero length. Thus the function scrapeToCsv can then be called with the results of getEmptyCsv

Examples

Run this code
 ## Not run: 
#    x<-getEmptyCsv()
#    # check if x is non null
#    scrapeToCsv(get = x)
#  
#  ## End(Not run)

Run the code above in your browser using DataLab