Package 'EviewsR'

Title: A Seamless Integration of 'EViews' and R
Description: It allows running 'EViews' (<https://eviews.com>) program from R, R Markdown and Quarto documents. 'EViews' (Econometric Views) is a statistical software for Econometric analysis. This package integrates 'EViews' and R and also serves as an 'EViews' Knit-Engine for 'knitr' package. Write all your 'EViews' commands in R, R Markdown or Quarto documents. For details, please consult our peer-review article Mati S., Civcir I. and Abba S.I (2023) <doi:10.32614/RJ-2023-045>.
Authors: Sagiru Mati [aut, cre]
Maintainer: Sagiru Mati <[email protected]>
License: GPL
Version: 0.1.6
Built: 2025-01-20 03:40:34 UTC
Source: https://github.com/sagirumati/eviewsr

Help Index


EviewsR: A Seamless Integration of 'EViews' and R

Description

It allows running 'EViews' (https://eviews.com) program from R, R Markdown and Quarto documents. 'EViews' (Econometric Views) is a statistical software for Econometric analysis. This package integrates 'EViews' and R and also serves as an 'EViews' Knit-Engine for 'knitr' package. Write all your 'EViews' commands in R, R Markdown or Quarto documents. For details, please consult our peer-review article Mati S., Civcir I. and Abba S.I (2023) doi:10.32614/RJ-2023-045.

Author(s)

Maintainer: Sagiru Mati [email protected] (ORCID)

See Also

Useful links:

Other important functions: create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()


Create an EViews object on an existing workfile

Description

Use this function in R, R Markdown or Quarto to create an EViews object on an existing workfile.

Usage

create_object(
  wf = "",
  page = "",
  action = "",
  action_opt = "",
  object_name = "",
  view_or_proc = "",
  options_list = "",
  arg_list = "",
  object_type = "",
  options = "",
  expression = ""
)

Arguments

wf

Object or a character string representing the name of an EViews workfile.

page

Object or a character string representing the name of an EViews workfile page.

action

Any valid EViews command for EViews object declaration, like freeze, do, equation, table.

action_opt

An option that modifies the default behaviour of the EViews action.

object_name

The name of the EViews object to be acted upon.

view_or_proc

The EViews object view or procedure to be performed.

options_list

An option that modifies the default behaviour of the EViews view or procedure.

arg_list

A list of EViews view or procedure arguments.

object_type

EViews object type such as series, equation.

options

Options for the object_type.

expression

Value to be assigned to the object

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
demo(exec_commands)

create_object(wf="exec_commands",action="equation",
object_name="create_object",view_or_proc="ls",arg_list="y ar(1)")

create_object(wf="exec_commands",object_name="x1",
object_type="series",expression="y^2")


## End(Not run)

EviewsR: A Seamless Integration of R and EViews

Description

This package runs on top of knitr to facilitate communication with EViews. Run EViews scripts from R Markdown document.

Usage

eng_eviews(options)

Arguments

options

Chunk options, as provided by knitr during chunk execution. Chunk option for this is eviews

Details

The EViews engine can be activated via

knitr::knit_engines$set(eviews = EviewsR::eng_eviews)

This will be set within an R Markdown document's setup chunk.

Value

Set of EViews codes

Author(s)

Sagiru Mati, ORCID: 0000-0003-1413-3974, https://smati.com.ng

  • Yusuf Maitama Sule (Northwest) University Kano, Nigeria

  • SMATI Academy

References

Mati, Sagiru. 2020a. “DynareR: Bringing the Power of Dynare to R, R Markdown, and Quarto.” CRAN. https://CRAN.R-project.org/package=DynareR.

Mati, Sagiru. 2020b. EviewsR: A Seamless Integration of EViews and R. https://CRAN.R-project.org/package=EviewsR.

Mati, Sagiru. 2020c. gretlR: A Seamless Integration of Gretl and R. https://CRAN.R-project.org/package=gretlR.

Mati, Sagiru. 2023b. URooTab: Tabular Reporting of EViews Unit Root Tests. https://CRAN.R-project.org/package=URooTab.

Mati, Sagiru, Irfan Civcir, and S. I. Abba. 2023. “EviewsR: An r Package for Dynamic and Reproducible Research Using EViews, r, r Markdown and Quarto.” The R Journal 15 (2): 169–205. https://doi.org/10.32614/rj-2023-045.

Bob Rudis (2015).Running Go language chunks in R Markdown (Rmd) files. Available at: https://gist.github.com/hrbrmstr/9accf90e63d852337cb7

Yihui Xie (2019). knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version 1.24.

Yihui Xie (2015) Dynamic Documents with R and knitr. 2nd edition. Chapman and Hall/CRC. ISBN 978-1498716963

Yihui Xie (2014) knitr: A Comprehensive Tool for Reproducible Research in R. In Victoria Stodden, Friedrich Leisch and Roger D. Peng, editors, Implementing Reproducible Computational Research. Chapman and Hall/CRC. ISBN 978-1466561595 #insertAllCited

See Also

Other important functions: EviewsR-package, create_object(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

knitr::knit_engines$set(eviews = EviewsR::eng_eviews)
library(EviewsR)

Create an EViews graph in R, R Markdown and Quarto.

Description

Use this function to create an EViews graph in R and R Markdown

Usage

eviews_graph(
  wf = "",
  page = "*",
  series = "*",
  group = FALSE,
  graph_command = "line",
  graph_options = "",
  mode = "overwrite",
  graph_procs = "",
  datelabel = "",
  save_options = "",
  save_path = "",
  frequency = "m",
  start_date = "",
  save_copy = TRUE
)

Arguments

wf

Object or a character string representing the name of an EViews workfile.

page

Object or a character string representing the name of an EViews workfile page.

series

A vector of names or wildcard expressions for series object(s) contained in an EViews workfile. An R dataframe is also acceptable.

group

Logical, whether to use group view in EViews, that is merge two or more graphs on one page. Setting group=FALSE produces EViews graph for each series separately.

graph_command

Object or a character string of any of the acceptable EViews graphical commands, such as line, bar, pie.

graph_options

Object or a character string of any of the acceptable EViews graphical options, such as "", m, s.

mode

Set mode="overwrite" to overwrite existing EViews graph objects that match the new EViews graph object to be created on the workfile. Set mode="" to avoid overwriting exising EViews graph object.

graph_procs

A vector containing EViews graph procs such as datelabel, align

datelabel

A vector containing EViews axis label formats such as format("YY"). Using datelabel in graph_procs overwrites this argument.

save_options

A vector of options to be passed to EViews save command. It can take values like "t=png",-c and so on.

save_path

Object or a character string representing the path to the folder to save the EViews graphs. The current working directory is the default save_path. Specify the save_path only if you want the EViews graphs to live in different path from the current working directory.

frequency

Object or a character string representing the frequency of a workfile page to be created. Only letters accepted by EViews are allowed. For example u for undated, a for annual, m for monthly and so on.

start_date

Object or a character string representing the start date. It should be left blank for undated (when the frequency is u).

save_copy

Logical. Whether to save the copy of the graph objects.

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
demo(exec_commands)

eviews_graph(wf="exec_commands",page = "eviewspage1",series="x y",mode = "overwrite",
graph_options = "m")

# Create graph(s) from dataframe

Data=data.frame(x=cumsum(rnorm(100)),y=cumsum(rnorm(100)))

eviews_graph(series=Data,start_date=1990,frequency="m")

# Create graphs in one frame (group=TRUE)

eviews_graph(series=Data,group=TRUE,start_date="1990Q4",frequency="Q")

## End(Not run)

Import data to EViews workfile

Description

Use this function in R, R Markdown and Quarto to import data to EViews workfile.

Usage

eviews_import(
  source_description = "",
  wf = "",
  type = "",
  options = "resize",
  smpl_string = "@all",
  genr_string = "",
  rename_string = "",
  frequency = "",
  start_date = "",
  id = "",
  destid = "",
  append = FALSE,
  save_path = ""
)

Arguments

source_description

Description of the file from which the data is to be imported. The specification of the description is usually just the path and file name of the file.

wf

Object or a character string representing the name of an EViews workfile.

type

Optional. Specify the file type, it can values allowed by EViews import commands like access, text. For the most part, you should not need to specify a “type=” option as EViews will automatically determine the type from the filename.

options

Optional.Specify the EViews options for import command like resize, link, page=page_name.

smpl_string

Optional. Specify the sample to be used for the data import.

genr_string

Optional. Any valid EViews series creation expression to be used to generate a new series in the workfile as part of the import procedure.

rename_string

Optional. Pairs of old object names followed by the new name to be used to rename some of the imported series.

frequency

Object or a character string representing the frequency of a workfile page to be created. Only letters accepted by EViews are allowed. For example u for undated, a for annual, m for monthly and so on.

start_date

Object or a character string representing the start date. It should be left blank for undated (when the frequency is u).

id

Name of EViews ID series. Required for EViews Match-Merge Import.

destid

Name of the destination ID. Required for EViews Match-Merge Import.

append

Logical, whether to append to the bottom of the EViews workfile page or not.

save_path

Specify the path to save the Eviews workfile

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
Data=data.frame(x=cumsum(rnorm(100)),y=cumsum(rnorm(100)))
write.csv(Data,"eviews_import.csv",row.names = FALSE)

eviews_import(source_description = "eviews_import.csv",start_date = "1990",frequency = "m",
rename_string = "x ab",smpl_string = "1990m10 1992m10")

# Alternatively, use the dataframe as the source_description

eviews_import(source_description = Data,wf="eviews_import1",start_date = "1990",
frequency = "m",rename_string = "x ab",smpl_string = "1990m10 1992m10")

## End(Not run)

Save an EViews workfile page.

Description

Use this function in R, R Markdown and Quarto to save an EViews workfile page.

Usage

eviews_pagesave(
  wf = "",
  page = "",
  options = "",
  source_description = "",
  table_description = "",
  keep_list = "",
  drop_list = "",
  keepmap_list = "",
  dropmap_list = "",
  smpl_spec = "",
  save_path = dirname(source_description)
)

Arguments

wf

Object or a character string representing the name of an EViews workfile.

page

Object or a character string representing the name of an EViews workfile page.

options

Object or a character string of any of the acceptable EViews pagesave options, such as noid, nomapval, nonames.

source_description

The path and name of the file to be saved.

table_description

Further description of the source_description such as specifying the range=arg, byrow.

keep_list

Optional. Specify the list of EViews object to be saved.

drop_list

Optional. Specify the list of EViews object to be dropped.

keepmap_list

Optional. Specify the list of patterns of EViews object to be saved.

dropmap_list

Optional. Specify the list of patterns of EViews object to be dropped.

smpl_spec

Optional. Specify the EViews sample string

save_path

Object or a character string representing the path to the folder to save the EViews graphs. The current working directory is the default save_path. Specify the save_path only if you want the EViews graphs to live in different path from the current working directory.

Value

An EViews workfile.

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
demo(exec_commands)

eviews_pagesave(wf="exec_commands",source_description = "eviews_pagesave.csv",
drop_list = "y")

## End(Not run)

Create an EViews workfile.

Description

Use this function in R, R Markdown and Quarto to create an EViews workfile.

Usage

eviews_wfcreate(
  source_description = "",
  wf = "",
  page = "",
  prompt = FALSE,
  frequency = "",
  subperiod_opts = "",
  start_date = "",
  end_date = "",
  num_cross_sections = NA,
  num_observations = NA,
  save_path = ""
)

Arguments

source_description

Description of the file from which the data is to be imported. The specification of the description is usually just the path and file name of the file.

wf

Object or a character string representing the name of a workfile to be created

page

Object or a character string representing the name of a workfile page to be created

prompt

Logical, whether to force the dialog to appear from within an EViews program

frequency

Object or a character string representing the frequency of a workfile page to be created. Only letters accepted by EViews are allowed. For example u for undated, a for annual, m for monthly and so on.

subperiod_opts

Optional integer value. Include subperiod_opts to define subperiod options for frequency argument.

start_date

Object or a character string representing the start date. It should be left blank for undated (when the frequency is u).

end_date

Object or a character string representing the end date. It should be left blank for undated (when the frequency is u).

num_cross_sections

Optional integer value. Include num_cross_sections in order to create an EViews balanced panel page using integer identifiers for each of the cross-sections.

num_observations

Numeric value. Specify the number of observations if the frequency="u".

save_path

Specify where to save the EViews workfile.

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
eviews_wfcreate(wf="eviews_wfcreate",page="EviewsR_page",frequency = "m",
start_date = "1990",end_date = "2022")

# Create a workfile from a dataframe

Data=data.frame(x=cumsum(rnorm(100)),y=cumsum(rnorm(100)))

eviews_wfcreate(source_description=Data,wf="eviews_wfcreate1",page="EviewsR_page",frequency="m",
start_date="1990")

## End(Not run)

Save an EViews workfile.

Description

Use this function in R, R Markdown and Quarto to save an EViews workfile.

Usage

eviews_wfsave(
  wf = "",
  page = "",
  options = "",
  source_description = "",
  table_description = "",
  keep_list = "",
  drop_list = "",
  keepmap_list = "",
  dropmap_list = "",
  smpl_spec = "",
  save_path = dirname(source_description)
)

Arguments

wf

Object or a character string representing the name of an EViews workfile.

page

Object or a character string representing the name of an EViews workfile page.

options

Object or a character string of any of the acceptable EViews pagesave options, such as noid, nomapval, nonames.

source_description

The path and name of the file to be saved.

table_description

Further description of the source_description such as specifying the range=arg, byrow.

keep_list

Optional. Specify the list of EViews object to be saved.

drop_list

Optional. Specify the list of EViews object to be dropped.

keepmap_list

Optional. Specify the list of patterns of EViews object to be saved.

dropmap_list

Optional. Specify the list of patterns of EViews object to be dropped.

smpl_spec

Optional. Specify the EViews sample string

save_path

Object or a character string representing the path to the folder to save the EViews graphs. The current working directory is the default save_path. Specify the save_path only if you want the EViews graphs to live in different path from the current working directory.

Value

An EViews workfile.

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
 demo(exec_commands)

eviews_wfsave(wf="exec_commands",source_description = "eviews_wfsave.csv",
drop_list = "x")

## End(Not run)

Execute EViews commands.

Description

Use this function in R, R Markdown and Quarto to execute EViews commands.

Usage

exec_commands(commands = "", wf = "", page = "", save_path = "")

Arguments

commands

Object or a vector of character strings of EViews commands

wf

Object or a character string representing the name of an EViews workfile.

page

Object or a character string representing the name of an EViews workfile page.

save_path

Object or a character string representing the path to the folder to save the EViews graphs. The current working directory is the default save_path. Specify the save_path only if you want the EViews graphs to live in different path from the current working directory.

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
# The first example creates an `EViews` workfile with monthly frequency from 1990 2021,
# then save the workfile in the current working directory

exec_commands(c("wfcreate(wf=exec_commands,page=eviewsPage) m 2000 2022"))

# The second example opens the `EViews` workfile and then generate a random series
# named `y` and plots its line graph. It also freezes `ols` equation as `EviewsROLS`

eviewsCommands='pagecreate(page=eviewspage1) 7 2020 2022
for %page eviewspage eviewspage1
pageselect {%page}
genr y=@cumsum(nrnd)
genr x=@cumsum(nrnd)
equation ols.ls y c x
graph x_graph.line x
graph y_graph.area y
freeze(OLSTable,mode=overwrite) ols
next'

exec_commands(commands=eviewsCommands,wf="exec_commands")

# unlink("exec_commands.wf1")

## End(Not run)

Export R dataframe as an EViews workfile

Description

Use this function to export R dataframe as an EViews workfile

Usage

export(
  source_description = "",
  wf = "",
  start_date = "",
  frequency = "",
  save_path = ""
)

Arguments

source_description

Description of the file from which the data is to be imported. The specification of the description is usually just the path and file name of the file.

wf

Object or a character string representing the name of a workfile to be created

start_date

Object or a character string representing the start date. It should be left blank for undated (when the frequency is u).

frequency

Object or a character string representing the frequency of a workfile page to be created. Only letters accepted by EViews are allowed. For example u for undated, a for annual, m for monthly and so on.

save_path

Specify where to save the EViews workfile.

Value

An EViews workfile.

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
Data=data.frame(x=cumsum(rnorm(100)),y=cumsum(rnorm(100)))

export(wf="export",source_description=Data,start_date = '1990',frequency = "m")

## End(Not run)

Export R dataframe as an EViews workfile

Description

Use this function in R, R Markdown and Quarto to export an R dataframe as an EViews workfile

Usage

export_dataframe(
  source_description = "",
  wf = "",
  start_date = "",
  frequency = "",
  save_path = ""
)

Arguments

source_description

Description of the file from which the data is to be imported. The specification of the description is usually just the path and file name of the file.

wf

Object or a character string representing the name of a workfile to be created

start_date

Object or a character string representing the start date. It should be left blank for undated (when the frequency is u).

frequency

Object or a character string representing the frequency of a workfile page to be created. Only letters accepted by EViews are allowed. For example u for undated, a for annual, m for monthly and so on.

save_path

Specify where to save the EViews workfile.

Value

An EViews workfile.

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 

Data=data.frame(x=cumsum(rnorm(100)),y=cumsum(rnorm(100)))

export_dataframe(wf="export_dataframe",source_description=Data,start_date = '1990',frequency = "m")

## End(Not run)

Import EViews series objects as dataframe

Description

Use this function to import EViews series objects to R, R Markdown and Quarto as dataframe

Usage

import(
  object_name = "",
  wf = "",
  page = "",
  options = "",
  source_description = "",
  table_description = "",
  keep_list = "",
  drop_list = "",
  keepmap_list = "",
  dropmap_list = "",
  smpl_spec = ""
)

Arguments

object_name

Object name to be to store the imported EViews series.

wf

Object or a character string representing the name of an EViews workfile.

page

Object or a character string representing the name of an EViews workfile page.

options

Object or a character string of any of the acceptable EViews pagesave options, such as noid, nomapval, nonames.

source_description

The path and name of the file to be saved.

table_description

Further description of the source_description such as specifying the range=arg, byrow.

keep_list

Optional. Specify the list of EViews object to be saved.

drop_list

Optional. Specify the list of EViews object to be dropped.

keepmap_list

Optional. Specify the list of patterns of EViews object to be saved.

dropmap_list

Optional. Specify the list of patterns of EViews object to be dropped.

smpl_spec

Optional. Specify the EViews sample string

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
demo(exec_commands)

import(object_name="importedDataFrame",wf="EviewsR_exec_commands",drop_list = "y")

eviews$importedDataFrame

knitr::kable(head(eviews$importedDataFrame),format="pandoc",caption="Table from EviewsR")

## End(Not run)

Import EViews equation data members into R, R Markdown or Quarto.

Description

Use this function to import EViews equation data members into R, R Markdown or Quarto.

Usage

import_equation(wf = "", page = "*", equation = "*")

Arguments

wf

Object or a character string representing the name of an EViews workfile.

page

Object or a character string representing the name of an EViews workfile page.

equation

Name(s) or wildcard expressions for EViews equation object(s) in an EViews workfile

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
demo(exec_commands)

import_equation(wf="exec_commands",page="eviewsPage",equation="OLS")

# To access the data members in base R

eviews$eviewspage_ols

# To obtain R-squared value in base R

eviews$eviewspage_ols$r2

# To get the values above in R Markdown or Quarto:

# chunkLabel$eviewspage_ols

# chunkLabel$eviewspage_ols$r2

## End(Not run)

Import EViews graph objects(s) into R, R Markdown or Quarto.

Description

Use this function to import EViews graph objects(s) into R, R Markdown or Quarto.

Usage

import_graph(
  wf = "",
  page = "*",
  graph = "*",
  graph_procs = "",
  save_options = "",
  save_copy = T,
  save_path = dirname(wf)
)

Arguments

wf

Object or a character string representing the name of an EViews workfile.

page

Object or a character string representing the name of an EViews workfile page.

graph

Name(s) or wildcard expressions of EViews graph object(S)

graph_procs

A vector containing EViews graph procs such as datelabel, align

save_options

A vector of options to be passed to EViews save command. It can take values like "t=png",-c and so on.

save_copy

Logical. Whether to save the copy of the graph objects

save_path

Object or a character string representing the path to the folder to save the EViews graphs. The current working directory is the default save_path. Specify the save_path only if you want the EViews graphs to live in different path from the current working directory.

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_kable(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
demo(exec_commands)

# To import all graph objects

import_graph(wf="exec_commands")

# To import only graphs that begin with x:

import_graph(wf="exec_commands",graph="x*")

# To access the graph objects in base R:

# eviewspage-x_graph # graph saved in "figure/" folder

# To get the graph objects in R Markdown or Quarto

# chunkLabel-eviewspage-x_graph # graph saved in "fig.path" folder


## End(Not run)

Import EViews table object as kable

Description

Use this function to import EViews table object as kable

Usage

import_kable(
  wf = "",
  page = "",
  table = "",
  range = "",
  format = kable_format(),
  digits = getOption("digits"),
  row.names = NA,
  col.names = NA,
  align,
  caption = NULL,
  label = NULL,
  format.args = list(),
  escape = FALSE,
  table.attr = "",
  booktabs = TRUE,
  longtable = FALSE,
  valign = "t",
  position = "h",
  centering = TRUE,
  vline = getOption("knitr.table.vline", if (booktabs) "" else "|"),
  toprule = getOption("knitr.table.toprule", if (booktabs) "\\toprule" else
    "\\hline"),
  bottomrule = getOption("knitr.table.bottomrule", if (booktabs) "\\bottomrule" else
    "\\hline"),
  midrule = getOption("knitr.table.midrule", if (booktabs) "\\midrule" else
    "\\hline"),
  linesep = if (booktabs) c("", "", "", "", "\\addlinespace") else "\\hline",
  caption.short = "",
  table.envir = if (!is.null(caption)) "table",
  ...
)

Arguments

wf

Object or a character string representing the name of a workfile to be created

page

Object or a character string representing the name of a workfile page to be created

table

Name of an EViews table object in an EViews workfile

range

A vector of characters specifying the table range of rows and columns

format

A character string. Possible values are latex, html, pipe (Pandoc's pipe tables), simple (Pandoc's simple tables), rst, jira, and org (Emacs Org-mode). The value of this argument will be automatically determined if the function is called within a knitr document. The format value can also be set in the global option knitr.table.format. If format is a function, it must return a character string.

digits

Maximum number of digits for numeric columns, passed to round(). This can also be a vector of length ncol(x), to set the number of digits for individual columns.

row.names

Logical: whether to include row names. By default, row names are included if rownames(x) is neither NULL nor identical to 1:nrow(x).

col.names

A character vector of column names to be used in the table.

align

Column alignment: a character vector consisting of 'l' (left), 'c' (center) and/or 'r' (right). By default or if align = NULL, numeric columns are right-aligned, and other columns are left-aligned. If length(align) == 1L, the string will be expanded to a vector of individual letters, e.g. 'clc' becomes c('c', 'l', 'c'), unless the output format is LaTeX.

caption

The table caption. By default, it is retrieved from the chunk option tab.cap.

label

The table reference label. By default, the label is obtained from knitr::opts_current$get('label') (i.e., the current chunk label). To disable the label, use label = NA.

format.args

A list of arguments to be passed to format() to format table values, e.g. list(big.mark = ',').

escape

Boolean; whether to escape special characters when producing HTML or LaTeX tables. When escape = FALSE, you have to make sure that special characters will not trigger syntax errors in LaTeX or HTML.

table.attr

A character string for addition HTML table attributes. This is convenient if you simply want to add a few HTML classes or styles. For example, you can put 'class="table" style="color: red"'.

booktabs

T/F for whether to enable the booktabs format for tables. I personally would recommend you turn this on for every latex table except some special cases.

longtable

T/F for whether to use the longtable format. If you have a table that will span over two or more pages, you will have to turn this on.

valign

You probably won't need to adjust this latex option very often. If you are familiar with latex tables, this is the optional position for the tabular environment controlling the vertical position of the table relative to the baseline of the surrounding text. Possible choices are b, c and t (default).

position

This is the "real" or say floating position for the latex table environment. The kable only puts tables in a table environment when a caption is provided. That is also the reason why your tables will be floating around if you specify captions for your table. Possible choices are h (here), t (top, default), b (bottom) and p (on a dedicated page).

centering

T (default)/F. Whether to center tables in the table environment.

vline

vertical separator. Default is nothing for booktabs tables but "|" for normal tables.

toprule

toprule. Default is hline for normal table but toprule for booktabs tables.

bottomrule

bottomrule. Default is hline for normal table but bottomrule for booktabs tables.

midrule

midrule. Default is hline for normal table but midrule for booktabs tables.

linesep

By default, in booktabs tables, kable insert an extra space every five rows for clear display. If you don't want this feature or if you want to do it in a different pattern, you can consider change this option. The default is c(”, ”, ”, ”, '\addlinespace'). Also, if you are not using booktabs, but you want a cleaner display, you can change this to ”.

caption.short

Another latex feature. Short captions for tables

table.envir

You probably don't need to change this as well. The default setting is to put a table environment outside of tabular if a caption is provided.

...

Other arguments (see Examples and References).

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_series(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
demo(exec_commands)

# To import the entire table object

import_kable(wf="exec_commands",page="eviewspage",table="OLSTable",format="pandoc")

# To import certain RANGE of the table object

import_kable(wf="exec_commands",page="eviewspage",table="OLSTable",range="r7c1:r10c5",
format="pandoc")

## End(Not run)

Import EViews series objects(s) into R, R Markdown or Quarto.

Description

Use this function to import EViews series objects(s) into R, R Markdown or Quarto as dataframe or xts object.

Usage

import_series(wf = "", page = "*", series = "*", class = "df")

Arguments

wf

Object or a character string representing the name of a workfile to be created

page

Object or a character string representing the name of a workfile page to be created

series

Name(s) of EViews series object(s) in an EViews workfile

class

Class of the R object: df for dataframe, or xts for extendable time-series object.

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_table(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
demo(exec_commands)

# To import all series objects across all pages

import_series(wf="exec_commands")

# Plot the dataframe object

library(ggplot2)

ggplot(eviews$eviewspage,aes(x=date))+geom_line(aes(y=x,color="x"))+
geom_line(aes(y=y,color="y"))+labs(colour='',x="",y="")

# To import all series objects across all pages, as an `xts` object

import_series(wf="exec_commands",class="xts")

# Plot the `xts` object

autoplot(eviews$eviewspage,facet='')+xlab("")

# To import specific series objects, for example starting with Y

import_series(wf="exec_commands",series="y*")

# To import series objects on specific pages

import_series(wf="exec_commands",page="eviewspage")


# To access the series in base R

eviews$eviewspage %>% head()

# To get the values above in R Markdown or Quarto:

# chunkLabel$eviewspage


## End(Not run)

Import EViews table objects(s) into R, R Markdown or Quarto.

Description

Use this function to import EViews table objects(s) into R, R Markdown or Quarto.

Usage

import_table(wf = "", page = "*", table = "*")

Arguments

wf

Object or a character string representing the name of a workfile to be created

page

Object or a character string representing the name of a workfile page to be created

table

Name(s) or wildcard expressions for EViews table object(s) in an EViews workfile

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_workfile(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
demo(exec_commands)

# To import all table objects across all pages

import_table(wf="exec_commands")

# To import specific table objects, for example for example `OLSTable`

import_table(wf="exec_commands",table="OLStable")

# To import table objects on specific pages

import_table(wf="exec_commands",page="eviewspage")

# To access the table in base R

eviews$eviewspage_olstable

# To get the values above in R Markdown or Quarto

# chunkLabel$eviewspage_olstable


## End(Not run)

Import EViews equation data members, graph, series and table objects(s) into R, R Markdown or Quarto.

Description

Use this function to import EViews equation data members, graph, series and table objects(s) into R, R Markdown or Quarto.

Usage

import_workfile(
  wf = "",
  page = "*",
  equation = "*",
  graph = "*",
  series = "*",
  table = "*",
  graph_procs = "",
  save_options = "",
  save_path = dirname(wf),
  save_copy = T,
  class = "df"
)

Arguments

wf

Object or a character string representing the name of an EViews workfile.

page

Object or a character string representing the name of an EViews workfile page.

equation

Name(s) or wildcard expressions for EViews equation object(s) in an EViews workfile

graph

Name(s) or wildcard expressions of EViews graph object(S)

series

Name(s) of EViews series object(s) in an EViews workfile

table

Name(s) or wildcard expressions for EViews table object(s) in an EViews workfile

graph_procs

A vector containing EViews graph procs such as datelabel, align

save_options

A vector of options to be passed to EViews save command. It can take values like "t=png",-c and so on.

save_path

Object or a character string representing the path to the folder to save the EViews graphs. The current working directory is the default save_path. Specify the save_path only if you want the EViews graphs to live in different path from the current working directory.

save_copy

Logical. Whether to save the copy of the graph objects

class

Class of the R object: df for dataframe, or xts for extendable time-series object.

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), rwalk(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 
demo(exec_commands)

# To import all equation, graph, series and table objects across all pages

import_workfile(wf="exec_commands")

# To import specific objects

import_workfile(wf="exec_commands",equation="ols",graph="x*",series="y*",table="ols*")

# To import objects on specific page(s)

import_workfile(wf="exec_commands",page="eviewspage")


# To access the objects in base R

eviews$eviewspage_ols # equation
# eviewspage-x_graph # graph saved in "figure/" folder
eviews$eviewspage %>% head() # series
eviews$eviewspage_olstable  # table

# To get the values above in R Markdown or Quarto:

# chunkLabel$eviewspage_ols # equation
# chunkLabel-eviewspage-x_graph # graph saved in "fig.path" folder
# chunkLabel$eviewspage %>% head() # series
# chunkLabel$eviewspage_olstable  # table


## End(Not run)

Simulate a random walk process using an EViews engine.

Description

Use this function to simulate a random walk process using an EViews engine from R, R Markdown or Quarto.

Usage

rwalk(
  series = "",
  wf = "",
  page = "",
  drift = NA,
  rndseed = NA,
  frequency = "",
  start_date = "",
  end_date = "",
  num_cross_sections = NA,
  num_observations = NA,
  class = "df"
)

Arguments

series

Names of series for the random walk.

wf

Object or a character string representing the name of a workfile to be created

page

Object or a character string representing the name of a workfile page to be created

drift

Numeric value as the drift term for random walk.

rndseed

Set the seed for Eviews random number generator.

frequency

Object or a character string representing the frequency of a workfile page to be created. Only letters accepted by EViews are allowed. For example u for undated, a for annual, m for monthly and so on.

start_date

Object or a character string representing the start date. It should be left blank for undated (when the frequency is u).

end_date

Object or a character string representing the end date. It should be left blank for undated (when the frequency is u).

num_cross_sections

Optional integer value. Include num_cross_sections in order to create an EViews balanced panel page using integer identifiers for each of the cross-sections.

num_observations

Numeric value. Specify the number of observations if the frequency="u".

class

Class of the R object: df for dataframe, or xts for extendable time-series object.

Value

An EViews workfile

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), set_eviews_path()

Examples

library(EviewsR)
## Not run: 

# Simulate random walk and return as a dataframe object

rwalk(series="a b e",rndseed=12345,start_date = 1990,frequency="m",num_observations=100)

library(ggplot2)

ggplot(eviews$abe,aes(x=date))+geom_line(aes(y=a,color="a"))+
geom_line(aes(y=b,color="b"))+geom_line(aes(y=e,color="e"))+labs(colour='',x="",y="")

# To simulate random walk and return as an `xts` object

rwalk(series="X Y Z",rndseed=12345,start_date = 1990,frequency="m",num_observations=100,class="xts")

plot(eviews$xyz)

autoplot(eviews$xyz,facet="")+xlab("")


plot(eviews$XYZ)

# To simulate random walk series on existing workfile

eviews_wfcreate(wf="rwalk",page="rwalk",frequency="7",start_date=2020,end_date="2022")
rwalk(wf="rwalk",series="rw1 rw2 rw3",rndseed=12345,frequency="M")

head(eviews$rw1rw2rw3)

## End(Not run)

Set EViews path

Description

Use this function to set EViews path. It is only useful when the EViews is not installed in standard directory, or when there are multiple EViews executables and the user wants to use older version of EViews.

Usage

set_eviews_path(engine_path = "eviews")

Arguments

engine_path

Path to the EViews executable

Value

Character

See Also

Other important functions: EviewsR-package, create_object(), eng_eviews(), eviews_graph(), eviews_import(), eviews_pagesave(), eviews_wfcreate(), eviews_wfsave(), exec_commands(), export(), export_dataframe(), import(), import_equation(), import_graph(), import_kable(), import_series(), import_table(), import_workfile(), rwalk()

Examples

library(EviewsR)
## Not run: 
set_eviews_path('C:/Program Files (x86)/EViews 10/eviews10.exe')

## End(Not run)