Learn R Programming

googlePublicData (version 0.15.7.28)

genMoreInfo: Generates a dataframe used to complement a DSPL bundle

Description

Parsing csv, tab or xls(x) files at a specific directory path, genMore info generates a dataframe used to complete a DSPL bundle with a more complete concepts definition including description, url, etc..

Usage

genMoreInfo(path, encoding=getOption("encoding"), sep=";", output=NA, action="merge", dec=".")

Arguments

path
String. Path to the folder where the tables are saved.
encoding
The enconding of the files to be parsed.
sep
The separation character of the tables in the 'path' folder. Currently supports introducing the following arguments: ``,'' or ``;'' (for .csv files), ``\t'' (for .tab files) and ``xls'' or ``xlsx'' (for microsofts excel files); the last one using XLConnect library.
output
If defined, the place where to save the dataframe as tab file. Otherwise it returns a data frame object.
action
Tells the function what to do if there's a copy of the file. Available actions are ``merge'' and ``replace''.
dec
String. Decimal point.

Value

If no output defined, genMoreInfo returns a dataframe with the following columns.
id
XML id of the concept (autogenerated)
label
The label of the concept (autogenerated)
description
A breif description of the concept
topic
The topic of the concept
url
A URL for the concept where, for example, to get more info
totalName
A total name as specified by DSPL languge (works for dimentional concepts)
pluralName
A total name as specified by DSPL language (works for dimentional concepts)

Details

If there isn't any output defiend (NA) the function returns a dataframe containing concepts as observations. Using this, the user may add more descripting info about concepts. In turn it writes a tab file with the dataframe described above. The user may recycle this file writing ``append'' in the action argument.

References

Google Public Data Explorer: http://publicdata.google.com

Examples

Run this code
  ## Not run: 
#     # Parsing some xlsx files at "my stats folder" to gen a "moreinfo" dataframe
#     INFO <- genMoreInfo(path="my stats folder/", sep="xls")
#     
#     # Rows 1 to 10 are about "Poverty" and rows 11 to 20 about "Education"
#     # So we fill the "topic" column with it.
#     INFO$topic[1:10] <- "Poverty"
#     INFO$topic[11:20] <- "Education"
#     
#     # Finally, we build the DSPL ZIP including more info
#     dspl(path="my stats folder/", sep="xls", moreinfo=INFO)
#     
#   ## End(Not run)

Run the code above in your browser using DataLab