2010-07-16 1 views
4

:R의 인터랙티브 그래프 다음 XML 코드에서 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 파일을 설정하는 방법이 있습니까?

+0

Ggobi는 웹과 아무 관련이 없습니다. 당신은 잘못된 기술을보고 있습니다. –

+3

XML을 게시하는 대신 R에로드하고 원하는 모든 변환을 적용한 다음 dput (dest.df)의 출력을 질문에 붙여 넣는 것이 좋습니다. 그러면 응답자에게 몇 가지 단계가 저장됩니다. – JoFrhwld

+0

다음 번에 시도해 보겠습니다. 내가 dput (test.)을 실행할 수 있다고 가정 할 때 나는 맞습니까?df) R 코드 끝 부분에 구조체 (list (.... 질문이 있습니까? –

답변

2

글쎄, 몇 가지 포인터에 대한 :

HTH

놈의 Rapache

당신은 아마도 Open Flash Chart

드로잉 플러스 난 주제에이 link을 발견 할 수

2

안토니, 나는 당신이 을 GGobi에서 기능을 사용할 수 있습니다. 도구> 저장 디스플레이 설명 및 CRAN에서 사용 가능한 DescribeDisplay 패키지를 사용하여 GGplot 그래프를 R로 내보내거나 가져올 수 있습니다. DescribeDisplayggplot2 또는 "내장"graphics 패키지가 필요합니다. 즉, qplot 또는 plot을 사용하여 그래프를 얻으십시오.) = the link를 참조 소개

기능을 "GET-정보를 클릭하고 -"- RApache 중 하나 도움이 될 수 없습니다 :

일단 저장, 디스플레이 설명으로 가져올 수 있습니다! identifylocator 기능이 graphics과 함께 작동하며 R 내의 클릭 및 가져 오기 정보를 사용할 수 있습니다 (Maindonald, JH - "R을 사용하여 데이터 분석 및 그래픽"- 3.4 참조). 그림 지역, 무료이며 사용할 수있는 here). 웹에서 더 야심 찬 일을하려는 경우 HTML <map><area> 태그 (여기에 an example)를 참조하십시오. 그렇다면 여러분은 JavaScript야말로 (좌표와 물건을 정의하는) 몇 가지 JavaScript 마법을 수행 할 것입니다.

참조 : graphics::textggplot2::geom_text.