從下面的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