2015-11-10 41 views
-1

我有一個示例文本爲「單擊此處」,當我點擊該文本時,它必須帶我到另一個頁面,例如截至現在說「www.google.com」如何利用R語言來使用它。必須添加哪些庫才能執行此操作。如何通過使用R語言執行鑽取

我用

library("grid") 
library("lattice", lib.loc="C:/Program Files/R/R-3.2.2/library") 
library("ggplot2", lib.loc="~/R/win-library/3.2") 

topvp <- viewport(y=1, just="top", name="topvp",height=unit(1, "lines")) 
botvp <- viewport(y=0, just="bottom", name="botvp",height=unit(1, "npc") - unit(1, "lines")) 
grid.rect(gp=gpar(fill="grey"), vp=topvp, name="toprect") 
grid.rect(vp=botvp, name="botrect") 


library("gridSVG") 

widthValues <- unit(c(1, 1), c("npc", "in")) 

widthvalues 

grid.animate("toprect", width=widthValues, duration=3) 
grid.animate("botrect", width=widthValues, duration=3) 


gridToSVG("gridanim.svg")#not connecting shown with an error message 
grid.export("gridanim.svg") 

grid.text("Click Here", vp=topvp, name="hypertext") 
grid.hyperlink("hypertext", "http://www.google.com") 

它正在創建矩形和執行的動畫,但是當我打點擊此處文本它不帶我去谷歌網頁也顯示手形符號。

感謝提前:)

+0

輸出你需要爲這個美好的稱號。 –

+0

看着這段代碼和你自己的回答,似乎你只是不按順序犯下這些行爲。這看起來似乎讓你感到尷尬並且刪除了這個問題。投票結束太簡單而無法保證SO空間。 –

回答

0

執行這些步驟 第1步:添加庫文件

library("grid") 
library("gridSVG") 

第2步:執行這些行

grid.text("Click Here", vp=topvp, name="hypertext") 
grid.hyperlink("hypertext", "http://www.google.com") 

步驟3:保存文件默認它存儲在文檔中或指定到您想要保存的文件夾。

gridToSVG("gridhyper.svg") 

第4步:打開谷歌Chrome或Firefox的文件,看看用行動