-
Notifications
You must be signed in to change notification settings - Fork 29
/
rcallscript.ado
39 lines (29 loc) · 1.14 KB
/
rcallscript.ado
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
program define rcallscript, rclass
syntax [anything] using/ , [Args(string asis)] [vanilla]
// check that the last character of the args is not ";"
if (substr(`"`macval(args)'"',-1,.)) != ";" {
local args = `"`macval(args)';"'
}
confirm file `"`using'"'
rcall `vanilla': `args' source("`macval(using)'")
return add
end
/*
drop _all
rcall clear
capture prog drop rcall
sysuse auto, clear
rcall: df<-st.data()
// create an r script named rscriptexample
rcall script rscriptexample.R , args(df<-st.data();mat<-as.matrix(df[,c("price","mpg")]))
rcall script rscriptexample.R , args(df<-st.data();mat<-as.matrix(df[,c("price","mpg")]);)
rcall script: rscriptexample.R , args(df<-st.data())
rcall script: rscriptexample.R , args(df<-st.data()) vanilla
rcall script: rscriptexample.R , args(df<-st.data();)
rcall script: rscriptexample.R , args(df<-st.data();) vanilla
rcall script : "rscriptexample.R", args(df<-st.data();)
rcall script : "rscriptexample.R", args(df<-st.data();) vanilla
rcall script : "rscriptexample.R" , args(df<-st.data();)
rcall script : "rscriptexample.R" , args(df<-st.data();) vanilla
return list
*/