emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-babel R :results output changes with block level :session se


From: Eric Schulte
Subject: Re: [O] org-babel R :results output changes with block level :session setting
Date: Tue, 05 Jun 2012 08:45:56 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.97 (gnu/linux)

Greg Tucker-Kellogg <address@hidden> 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,

#+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
-- 
Eric Schulte
http://cs.unm.edu/~eschulte

reply via email to

[Prev in Thread] Current Thread [Next in Thread]