[R] R2HTML: request for an extended example

Tobias Verbeke tobias.verbeke at telenet.be
Wed Aug 9 22:04:31 CEST 2006


Michael Kubovy wrote:
> On Aug 9, 2006, at 9:23 AM, Tobias Verbeke wrote:
>> Michael Kubovy wrote:
>>> Dear R-helpers,
>>>
>>> If you know of an extended example of the use of R2HTML, in which 
>>> the  various constructs are present in one place, could you please 
>>> point  me to it or send it to me?
>>>
>> There was an article in the R News of December 2003
>>
>> http://cran.r-project.org/doc/Rnews/
>
> Thanks, Tobias. That's just what I needed.
>
> I ran into a small problem: when I run the following, the HTML is 
> missing some kind of icon at the top. Any ideas how to fix that?
>
> > HTMLStart(outdir = file.path("/Users", "mk", "Documents", "teach", 
> '2006.3.PSYC712'), echo = T, HTMLframe = F, Title = 'John Doe HW 1')
>
> *** Output redirected to directory:  
> /Users/mk/Documents/teach/2006.3.PSYC712
> *** Use HTMLStop() to end redirection.[1] TRUE
> HTML> as.title("This is my first title")
> [1] "This is my first title"
> attr(,"class")
> [1] "title"
> HTML> x <- 1
> HTML> y<- 2
> HTML> x+y
> [1] 3
> HTML> HTMLStop()
> [1] "/Users/mk/Documents/teach/2006.3.PSYC712/index.html"
I adapted your code to my situation (using R2HTML 1.57 on
R 2.3.1 under GNU/Linux and Firefox 1.5.0.4 to open the
resulting HTML file) and did not notice a missing icon.

What browser do you use ?

library(R2HTML)
HTMLStart(outdir = file.path("/home", "tobias", "R", "packages", "R2HTML"),
                   # mind the TRUE instead of T and the FALSE instead of F
                   echo = TRUE, HTMLframe = FALSE, Title = "John Doe HW 1")
as.title("This is my first title")
x <- 1
y <- 2
x + y
HTMLStop()

--Tobias

PS page source code obtained:

<html xmlns:mml="http://www.w3.org/1998/Math/MathML">
<head>
<title> John Doe HW 1 </title>
<link rel=stylesheet href="R2HTML.css" type=text/css>
<object id="mathplayer" classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987"></object>
<?import namespace="mml" implementation="#mathplayer"?>
<script type="text/javascript" src="ASCIIMathML.js"></script>
<link href="./runtime/styles/xp/grid.css" rel="stylesheet" type="text/css" ></link>
<link href="gridR2HTML.css" rel="stylesheet" type="text/css" ></link>

<script src="./runtime/lib/grid.js"></script>

<script src="./gridR2HTML.js"></script>

<script>
   nequations=0;
</script>
</head>
<body onload="translate()" bgcolor= FFFFFF background="" >
<a name=Num2>&nbsp;</a><p><xmp class=command>> as.title("This is my first title")</xmp></p>
 <h2 > This is my first title</h2>
<a name=Num3>&nbsp;</a><p><xmp class=command>> x <- 1</xmp></p>
<a name=Num4>&nbsp;</a><p><xmp class=command>> y <- 2</xmp></p>
<a name=Num5>&nbsp;</a><p><xmp class=command>> x + y</xmp></p><p class='numeric'>3</p>

<hr size=1>
<font size=-1>
	 Generated on: <I>Wed Aug  9 21:29:45 2006</i> - <b>R2HTML</b> 
<hr size=1>
	</body>
</html



More information about the R-help mailing list