从下面的XML代码:交互图中的R用rggobi
<?xml version = "1.0"?>
<Company >
<shareprice>
<timeStamp> 12:00:00.01</timeStamp>
<Price> 25.02</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:00.02</timeStamp>
<Price> 15</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:01.025</timeStamp>
<Price> 15.02</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:01.031</timeStamp>
<Price> 18.25</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:01.039</timeStamp>
<Price> 18.54</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:01.050</timeStamp>
<Price> 16.52</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:02.01</timeStamp>
<Price> 17.50</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:03.01</timeStamp>
<Price> 25.02</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:05.02</timeStamp>
<Price> 30</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:11.025</timeStamp>
<Price> 32.25</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:12.031</timeStamp>
<Price> 26.05</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:15.039</timeStamp>
<Price> 18.54</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:19.050</timeStamp>
<Price> 16.52</Price>
</shareprice>
<shareprice>
<timeStamp> 12:01:02.01</timeStamp>
<Price> 17.50</Price>
</shareprice>
</Company>
,并使用下述R代码:
library(ggplot2)
library (XML)
test.df <- xmlToDataFrame(file.choose())
test.df
sapply(test.df, class)
test.df$timeStamp <- strptime(as.character(test.df$timeStamp), "%H:%M:%OS")
test.df$Price <- as.numeric(as.character(test.df$Price))
sapply(test.df, class)
options("digits.secs"=3)
summary (test.df)
with(test.df, plot(timeStamp, Price))
sd (test.df$Price)
mean(test.df$timeStamp)
test.df$timeStamp <- test.df[1,"timeStamp"] + cumsum(runif(7)*60)
summary(test.df)
qplot(timeStamp,Price,data=test.df,geom=c("point","line"))
Price <- summary(test.df$Price)
print (Price)
我想创建交互式图形,将允许用户点击一个点,并获得关于该点的价值的信息(例如,如果价值跳动的原因如此),我希望能够将这个交互式图形放在网页上。有人建议使用GGOBI来做到这一点,而另一些人则说可以留在R中并使用rggobi库。由于我没有这方面的经验,我以为我会直接或要求一些指针或特定的资源(一个可以花几年搜索网络,没有找到任何东西)
下图我想打印出价格摘要。此刻,我在Windows上的BATCH文件中运行代码,它将图形以pdf文件形式返回,但不是摘要打印。是否有办法设置代码/ BATCH文件,以便它可以生成交互式图形和摘要?
Ggobi与网络无关。你正在看错技术。 – 2010-07-16 23:24:47
对于未来的帖子,如果不是发布xml,而是将其加载到R中,应用所需的所有转换,然后将'dput(dest.df)'的输出粘贴到您的问题中,那将会很好。这样可以节省答复者几个步骤。 – JoFrhwld 2010-07-17 15:14:22
我会在下次尝试。我正确地假设我可以运行dput(测试。df)在我有R代码的末尾粘贴结构(列表(....)到问题中? – 2010-07-18 17:14:34