1

我有这个脚本文件:

library(fBasics) # Load the package fBasics.
da=read.table("C:\\Users\\jose\\Tese\\Analysis of Financial Time Series\\dibm3dx7008.txt",header=T) # Load the data.

dim(da) # Find size of the data: 9845 rows and 5 columns.
da[1,] # See the first row of the data

ibm=da[,2] # Obtain IBM simple returns
sibm=ibm*100 # Percentage simple returns
basicStats(sibm) # Compute the summary statistics

我想从 powerpoint 运行它;我已经在PowerPoint中尝试过VBA,任何人都可以帮助我

4

2 回答 2

1

您可以将您的脚本放入 *.bat 文件中,然后通过 Shellexecute 从 Powerpoint 执行此文件。但这是一个可怕的痛苦,并且极易受到更改文件位置的影响。

一些代码:

Dim wshshell As Object
Set wshshell = CreateObject("WScript.Shell") 'a shellconsole
Dim Shellscript as String
ShellScript = "c:\yourscript.bat" 'if this contains white spaces you have to add chr(34)  at the beginning and end of the string.

wshshell.CurrentDirectory = YourProgramPath 'set the current directory
wshshell.Run shellscript, , True 'run the script

'then parse the results -sorry I have no idea how to do this in R.
于 2012-10-09T07:46:52.883 回答
1

不是对您问题的直接回答,但您可以看看将 Sweave(或 knitr)与投影仪幻灯片一起使用。

于 2012-10-09T01:02:25.053 回答