emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel R :results output changes with block level :session setting
@ 2012-06-02  1:11 Greg Tucker-Kellogg
  2012-06-05 14:45 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Tucker-Kellogg @ 2012-06-02  1:11 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

I'm trying to use org-mode to reproduce the HTML slide show made with knitr demonstrated at http://goo.gl/bOJJo .  The following single code block works

#+BEGIN_SRC R :results output html
  library(googleVis)
  G <- gvisGeoChart(Exports, "Country", "Profit", options = list(width = 250, 
      height = 120))
  print(G)
#+END_SRC

and wraps it in the needed HTML block, but if I set :session on the block the "R>" prompt is included in the output. If i set a file level session property it works fine, but if on a single block inserts the prompt.  I was expecting these would behave identically.

Is this the expected behavior?

Greg



[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: org-babel R :results output changes with block level :session setting
  2012-06-02  1:11 org-babel R :results output changes with block level :session setting Greg Tucker-Kellogg
@ 2012-06-05 14:45 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2012-06-05 14:45 UTC (permalink / raw)
  To: Greg Tucker-Kellogg; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]

Greg Tucker-Kellogg <gtuckerkellogg@gmail.com> writes:

> I'm trying to use org-mode to reproduce the HTML slide show made with
> knitr demonstrated at http://goo.gl/bOJJo .  The following single code
> block works
>
> #+BEGIN_SRC R :results output html
>   library(googleVis)
>   G <- gvisGeoChart(Exports, "Country", "Profit", options = list(width = 250, 
>       height = 120))
>   print(G)
> #+END_SRC
>
> and wraps it in the needed HTML block, but if I set :session on the
> block the "R>" prompt is included in the output. If i set a file level
> session property it works fine, but if on a single block inserts the
> prompt.  I was expecting these would behave identically.
>
> Is this the expected behavior?
>
> Greg
>

Hi Greg,

This is not expected behavior, and in fact I do not see this behavior on
my system.  I get the attached (below) results when running your code
block in a session.  Is it possible that you have customized your R
session prompt?  If so you may need to customize the R prompt regexp in
ob-R.el.  Currently this is a literal value on line 353, but if it would
be useful to customize this value I will make it a defcustom so that you
can customize it from your .emacs.

Best,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gvis.org --]
[-- Type: text/x-org, Size: 2763 bytes --]

#+BEGIN_SRC R :results output html :session
  library(googleVis)
  G <- gvisGeoChart(Exports, "Country", "Profit", options = list(width = 250, height = 120))
  print(G)
#+END_SRC

#+RESULTS:
#+BEGIN_HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>GeoChartID425d7603333b</title>
  <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  <style type="text/css">
    body {
          color: #444444;
          font-family: Arial,Helvetica,sans-serif;
          font-size: 75%;
    }
    a {
          color: #4D87C7;
          text-decoration: none;
    }
  </style>
</head>
<body>
 <!-- GeoChart generated in R 2.15.0 by googleVis 0.2.16 package -->
<!-- Tue Jun  5 08:42:40 2012 -->


<!-- jsHeader -->
<script type="text/javascript" src="http://www.google.com/jsapi">
</script>
<script type="text/javascript">
 
// jsData 
function gvisDataGeoChartID425d7603333b ()
{
  var data = new google.visualization.DataTable();
  var datajson =
[
 [
 "Germany",
          3 
],
[
 "Brazil",
          4 
],
[
 "United States",
          5 
],
[
 "France",
          4 
],
[
 "Hungary",
          3 
],
[
 "India",
          2 
],
[
 "Iceland",
          1 
],
[
 "Norway",
          4 
],
[
 "Spain",
          5 
],
[
 "Turkey",
          1 
] 
];
data.addColumn('string','Country');
data.addColumn('number','Profit');
data.addRows(datajson);
return(data);
}
 
// jsDrawChart
function drawChartGeoChartID425d7603333b() {
  var data = gvisDataGeoChartID425d7603333b();
  var options = {};
options["width"] =    250;
options["height"] =    120;

     var chart = new google.visualization.GeoChart(
       document.getElementById('GeoChartID425d7603333b')
     );
     chart.draw(data,options);
    

}
  
 
// jsDisplayChart 
function displayChartGeoChartID425d7603333b()
{
  google.load("visualization", "1", { packages:["geochart"] }); 
  google.setOnLoadCallback(drawChartGeoChartID425d7603333b);
}
 
// jsChart 
displayChartGeoChartID425d7603333b()
 
<!-- jsFooter -->  
//-->
</script>
 
<!-- divChart -->
  
<div id="GeoChartID425d7603333b"
  style="width: 250px; height: 120px;">
</div>
 <div><span>Data: Exports &#8226; Chart ID: <a href="Chart_GeoChartID425d7603333b.html">GeoChartID425d7603333b</a></span><br /> 
<!-- htmlFooter -->
<span> 
R version 2.15.0 (2012-03-30) &#8226; <a href="http://code.google.com/p/google-motion-charts-with-r/">googleVis-0.2.16</a>
&#8226; <a href="https://developers.google.com/terms/">Google Terms of Use</a> &#8226; <a href="https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart.html#Data_Policy">Data Policy</a>
</span></div>
</body>
</html>
#+END_HTML

[-- Attachment #3: Type: text/plain, Size: 46 bytes --]


-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-05 14:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-02  1:11 org-babel R :results output changes with block level :session setting Greg Tucker-Kellogg
2012-06-05 14:45 ` Eric Schulte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).