I have installed rapache, and created the r.load and r.conf files in /etc/apache2/mods-available. in r.conf I have placed the following lines.
<Locarion /R>
SetHandler r-script
RHandler sys.source
</Location>
And similary, for RApacheInfo. So far so good, because I have put files with R code inside / R and I can visualize the output in the browser.
But brew had problems, in r.conf for brew
<Location /brew>
SetHandler r-script
RHandler brew::brew
</Location>
And installed brew as follows
su root
R
> install.packages("brew")
> 127
127 indicates the mirror, but I only downloaded it, then I had to put it
> install.packages('package.tar.gz', lib="/usr/local/lib/R/site-library", repos = NULL)
And then I put a file inside /brew with html code and R code as well.
<html>
<head>
<title>R, HTML </title>
</head>
<body>
<h3>Test R and HTML </h3>
<p> rnorm </p>
<%
print(rnorm(100));
%>
</body>
</html>
But it only shows output for HTML, the code for R is shown as text.
¿Why it's not interpreting the R code?
And as I install several libraries so they all work in /R.
Related
curl -s http://virusradar.com/en/update/info/latest | grep -oP "(?\<=\<h1\>Update )\[0-9\]+"
When there was a base number in the header, it worked.
Now removed how to change the request.
Tell me good people.
That URL appears to be defunct:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved here.</p>
</body></html>
What do you mean by "base" ?
Please provide the original form of the command, so we could see how it was (incorrectly?) modified.
Question:
How do I place HTML files in place within an R Distill Markdown file?
Background:
I would like to embed / incorporate an external html file within a Distill Rmd file. I don't want to show the link to the html in the document, but the content of the html file. Something like include_graphics only for html.
I wasn't able to find something via google search. I only found Include HTML files in R Markdown file? where OP writes, he never figured out how to do it :(
From that post I tried htmltools::includeHTML("file.html") which didn't work,
and also shiny::includeHTML("file.html") which didn't work,
and even (it didn't work):
includes:
in_header: file.html
With htmltools::includeHTML I at least got the error message Error loading script: https://cdn.jsdelivr.net/npm//vega#5?noext which I couldn't make sense of :(
Though I can't reproduce this error-message now (a couple of weeks later). Maybe it is because I included library(htmltools). Though there still is no html embedded :(
However the Distill package apparently is able to do embed html, as the _footer.html is included correctly, but automatically (such that i wasn't able to find the command in the code).
Thanks a lot!
You might want to double check your R chunk arguments, does it have include=FALSE? because then you would be calling the HTML file, but then telling it not to be included, here is my distill Rmd file and the output with the included HTML code.
Rmarkdown
---
title: "Untitled"
output: distill::distill_article
---
```{r setup}
knitr::opts_chunk$set(echo = FALSE)
library(htmltools)
htmltools::includeHTML("test2.html")
```
HTML: titled test2.html located in same directory as .Rmd
<html>
<head>
</style>
<title>Title</title>
</head>
<body>
<p>This is an R HTML document. When you click the <b>Knit HTML</b> button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:</p>
<div class="chunk" id="unnamed-chunk-1"><div class="rcode"><div class="source"><pre class="knitr r" ><span class="hl kwd">summary</span><span class="hl std">(cars)</span>
</pre></div>
<div class="output"><pre class="knitr r">## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
</pre></div>
</div></div>
<p>You can also embed plots, for example:</p>
<div class="chunk" id="unnamed-chunk-2"><div class="rcode"><div class="source"><pre class="knitr r" ><span class="hl kwd">plot</span><span class="hl std">(cars)</span>
</pre></div>
</div><div class="rimage default"><img src="figure/unnamed-chunk-2-1.png" title="plot of chunk unnamed-chunk-2" alt="plot of chunk unnamed-chunk-2" class="plot" /></div></div>
</body>
</html>
output rendered to html
I am using notepad ++ for starters. I created a parent folder in my documents where I save my code, within that folder I created a subfolder to store images.
Below is the code I am using
<section>
<img src="img/vietnam.jpg"
</section>
Why won't it display? I have named the image vietnam.jpg in my subfolder :S
Here the issue it could be because your are not getting to the right path where your image lives.
If you have, for instance, your html file contained in a folder which is at the same level of your img folder then you should add ../ in order to get up one level and then specify which folder you would like to get into, in this case img folder.
Ex.:
<section>
<img src="../img/vietnam.jpg" alt="vietnam">
</section>
/ = Root directory
. = This location
.. = Up a directory
./ = Current directory
../ = Parent of current directory
../../ = Two directories backwards
If your HTML source file (e.g. index.html) is in the folder c:\Users\Patricia\Documents\adv, then as your img folder is a subfolder of \adv, the following should work.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<section>
<img src="img/vietnam.jpg" alt="vietnam">
</section>
</body>
</html>
What is the path to your HTML source parent folder?
Well, first of all i would suggest you to switch your code editor (e.g. to VisualStudio code as it is one of the editors used/preferred widely in the industries. Of course there's other Editrs/IDE's like WebStorm and so on ). Basically with the right plugins/configurations you will fasty become a superhero. For example, look at the screen below. I used relative path in VisualStudio and it shows the current path you're currently in.enter image description here
you are missing the closing bracket of img-tag, which leads to invalid html that cant be displayed properly
look at the example https://www.w3schools.com/tags/tag_img.asp
<img src="/img/vietnam.jpg" >
I'm using WebStorm 10 with Jade. The generated HTML is not auto-indent, for e.g:
index.jade:
extends layout
block content
h1= title
p Welcome to #{title}
index.html
<!DOCTYPE html><html><head><title></title><link rel="stylesheet" href="/stylesheets/style.css"></head><body><h1></h1><p>Welcome to </p></body></html>
Is there a way to auto-indent the generated HTML ?
Ctrl + Alt + L on Windows and Linux
Option + Command + L on Mac OS X
See Reformatting Source Code
Updated
If you set the $FileName$ --pretty in Arguments: the output should be nicely formatted.
I need a HTML2RTF tool, that is, a software that converts HTML format to RTF format... But not "any convertion": I need to preserve the HTML class attributes (ex. of paragraphs) as MS-Word "styles".
My first option was some terminal command of LibreOffice, like
libreoffice --convert-to
because LibreWriter have the bigger community and suppose the best software convertion... But disappointed because not preserve class attributes as styles, even when testing as user in the graphical interface.
I need a Linux solution (also abiword not solved)... Or, last option, a webservice to easy plug in a intranet's Windows server.
Input sample:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>sample1 doc</title>
<!-- no style need, but can be declarated with anything, don't matter -->
<style type="text/css">
.myStyle1 {color: #F00;} .myStyle2 {color: #880;}
.a {color: #00F;} .b {color: #088;}
</style>
</head>
<body><!-- important to preserve class names -->
<p class="myStyle1">Hello in <i>style#1</i>.
<span class="a">SPAN S1</span>.</p>
<p class="myStyle2">... Hello in style#2...</p>
<p class="myStyle1">Bye <span class="b">S2</span>.</p>
</body>
</html>
In MS-Word this sample is imported and looks ok, with styles where was classes.
In LibreOffice (and libreoffice terminal tools) not.
So, there are another tool for LibreOffice? There are a tool for Linux?
PS: last possibility, if none for Linux, a webservice for Windows and MS-Office.
Works for me in Libreoffice 4.3.3.2. Just opened the HTML file you provided and I can see styles named Text.Body.myStyle1 and myStyle2.
Clues, for Debian Stable and UBUNTU LTS 64bits... See this How-To. Basic steps:
sudo apt-get remove libreoffice*
wget http://download.documentfoundation.org/libreoffice/stable/4.3.3/deb/x86_64/LibreOffice_4.3.3_Linux_x86-64_deb.tar.gz
tar -xzvf LibreOffice_4.3.3_Linux_x86-64_deb.tar.gz
cd LibreOffice_4.3.3*_Linux_x86-64_deb/DEBS
sudo dpkg -i *.deb
After v4.3.3, need also to install:
sudo apt-get install libreoffice-writer
then, the cited command:
libreoffice --headless -convert-to rtf libreTeste.html