I'm glad this works for you. Myself, I would use paste() to collect the output to a single variable, then use one instance of cat() to write the whole thing to file. This saves you retyping ... file="treemap.html", append=TRUE,sep='\n' ... more than once and prevents errors such as the one you encountered.
The principle is called "DRY" - Do not Repeat Yourself. Perhaps the simplest yet most powerful way to write better code. All the best, B. On Jun 4, 2015, at 5:00 AM, valerio orfano <ingorf...@hotmail.com> wrote: > I forgot to use fie= treemap.html :) > > > On 04 Jun 2015, at 10:53, valerio orfano <ingorf...@hotmail.com> wrote: > >> I have the following code: >> >> setwd("C:/Users/Administrator/Desktop") >> cat("<!DOCTYPE html>",file="treemap.html", append=TRUE,sep='\n') >> cat("<html>",file="treemap.html", append=TRUE,sep='\n') >> cat("<body>",file="treemap.html", append=TRUE,sep='\n') >> cat("<h1>TreeMap</h1>",file="treemap.html", append=TRUE,sep='\n') >> cat("<img src='Storage001.png'>","treemap.html", append=TRUE,sep='\n') >> cat("</body>",file="treemap.html", append=TRUE,sep='\n') >> cat("</html>",file="treemap.html", append=TRUE,sep='\n') >> >> >> but this tag is not getting written in html file >> cat("<img src='Storage001.png'>","treemap.html", append=TRUE,sep='\n’) >> >> so i cannot display the img my html >> >> belowe the resulting html >> >> <!DOCTYPE html> >> <html> >> <body> >> <h1>TreeMap</h1> >> </body> >> </html> >> <!DOCTYPE html> >> <html> >> <body> >> <h1>TreeMap</h1> >> </body> >> </html> >> >> >> Any help >> >> rgds valerio >> On 03 Jun 2015, at 19:06, MacQueen, Don <macque...@llnl.gov> wrote: >> >>> When it's as simple as in Boris's example, just use cat() statements. >>> >>> Otherwise, go to CRAN, find the packages page ("Table of available >>> packages, sorted by name"), and search for "html" >>> >>> -Don >>> >>> -- >>> Don MacQueen >>> >>> Lawrence Livermore National Laboratory >>> 7000 East Ave., L-627 >>> Livermore, CA 94550 >>> 925-423-1062 >>> >>> >>> >>> >>> >>> On 6/3/15, 9:38 AM, "valerio orfano" <ingorf...@hotmail.com> wrote: >>> >>>> Hi Boris and thanx a lot >>>> >>>> Which library should i be using to create html in R? >>>> >>>> rgds valerio >>>> On 03 Jun 2015, at 18:08, Boris Steipe <boris.ste...@utoronto.ca> wrote: >>>> >>>>> ... as in: the png exists in a directory that is accessible to the >>>>> server? >>>>> >>>>> That would be as simple as creating a HTML document with the following >>>>> contents: >>>>> >>>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" >>>>> "http://www.w3.org/TR/html4/strict.dtd"> >>>>> <html> >>>>> <head><title="Image"></head> >>>>> <body><img src="myPNGimage.png"></body> >>>>> </html> >>>>> >>>>> >>>>> B. >>>>> >>>>> >>>>> On Jun 3, 2015, at 11:32 AM, valerio orfano <ingorf...@hotmail.com> >>>>> wrote: >>>>> >>>>>> Hi All >>>>>> >>>>>> Is there any chance in R to convert a png and/or pdf file into an html? >>>>>> Any example? >>>>>> >>>>>> I¹ve tried htmlize but doesn¹t work out! >>>>>> >>>>>> Rgds valerio >>>>>> ______________________________________________ >>>>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>> PLEASE do read the posting guide >>>>>> http://www.R-project.org/posting-guide.html >>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>> >>>> >>>> ______________________________________________ >>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>> >> > ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.