Description Usage Arguments Value Author(s) Examples
The function runs gretl scripts from inside R. Currently it outputs a list
with components specified by output
argument.
1 2 3 4 5 6 7 8 |
text |
gretl script formed as a character vector, see Examples. |
input |
determines additional components of input: scalars, vectors, matrices, and character strings:
For ' ' |
output |
determines components of the output list: it should
contain names of gretl script objects (in the |
data |
a name (without quotes) of an R |
A list with components specified by output
argument.
Output components could be numeric atomic vectors, matrices, or character vectors; gretl
scalars
,
row and column matrices
, and series
are converted to
atomic vectors.
Oleh Komashko
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # The differences with the native gretl script are:
# (i) name of character vector (gr.script <- here)
# (ii) quotes: for make hansl code a character string;
# quotes inside script should be escaped, e.g.
# text <- "eval \"hello, word\""
gr.script <-
"open denmark.gdt -q
ols diff(LRY) 0 diff(LRM) IBO --simple-print
restrict --silent
b[2] + b[3] = 0.3
end restrict
pv = $pvalue
if pv > 0.05
restrict --full
b[2] + b[3] = 0.3
end restrict
set warnings off
modtest --white-nocross
endif"
run_grcli(gr.script)
Rz = run_grcli('print w v x\n eval x**y\n z = mexp(y)\n print z',
input = list(matr = list(w = 1,v = 1:4, x= matrix(1:2,1),
y = matrix(rep(1,9),3))),
output = list(matr = "z"))
Rz$z
## Not run:
# After gretl is properly installed one can
# safely copy-past and run this example
scr <-
"nulldata 10
set seed 13
series y = normal()
matrix x = seq(1,7)
matrix z = mshape({y},5,2)
string str = \"Hello, user!\"
print str"
ou <- run_grcli(scr,output = list(matr=c("x","z"),char="str",series = "y"))
ou
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.