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,任何人都可以帮助我
答案 0 :(得分:1)
不能直接回答你的问题,但你可以看一下使用带有beamer幻灯片的Sweave(或knitr)。
答案 1 :(得分: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.