Learn R Programming

Rgretl (version 0.2.2)

open_gdt: opening gretl and gretl-supported data files

Description

The function can open data files of the following formats: *.gdt, *.gdtb (gretl data files), *.csv, *.txt, *.gnumeric (Gnumeric), *.ods (Open Document), *.xls, *.xlsx (Excel), *.dta (Stata), *.wf1 (Eviews), *.sav (SPSS), *.xpt (SAS xport), *.dat (JMulTi).

Usage

open_gdt(fpath, mkstruct = TRUE, info = TRUE)
# open_gdt("denmark.gdt")

Arguments

fpath

quoted name of a data file; the rules of adding the full path are the same as in gretl; can open data files of all gretl-supported formats: Stata, E-views, SPSS, SAS, etc. Path to a file is not needed for gretl sample files and for files in gretl working directory

mkstruct

logical; whether to preserve time series structure; currently only yearly, quarteerly, monthly, weekly and dayly data are supported: in these cases the output data frame columns will be ts objects with 'right' time-series attributes; otherwise the output data.frame contains character-valued column named "obs" which can be translated into time structure by a user.

info

logical; whether to import data description (if any); if info = TRUE (the default) the output data frame will have additional "description" attribute : a character vector containing data set information. It can be printed in intelligible form by description function.

Value

data.frame if info = TRUE it will have "description" attribute.

Examples

Run this code
# NOT RUN {
denmark = open_gdt("denmark.gdt")
head(denmark)
description(denmark)

# }
# NOT RUN {
gold = open_gdt("http://www.principlesofeconometrics.com/poe4/data/stata/gold.dta")
description(gold)
# }

Run the code above in your browser using DataLab