pacomet
pacomet

Reputation: 5141

Format r output in knitr

I'm trying to build an html page showing some output (max values, time recorded,...) inside a table. I'm using knitr for the first time in this type of reports

I have tried this code

<table>
<td class="celda1">
```{r results='asis', echo=FALSE}
print(output$Temperatura)
```
</td><td class="celda2">
```{r results='asis', echo=FALSE}
output$Hora1
```
</td>
</table>

with these results

enter image description here

Now I would like to remove the prefix number [1] just before the value. I am not familiar with knitr but have read some options for code chunks to remove warnings or ## comments but can't find how to remove the prefix.

Thanks in advance for your help

SOLUTION

Finally the solution came from the combination of cat and paste commands, following suggestion from @drmariod. Just cat for numeric values and cat-paste to preserve date format.

<table>
<td class="celda1">
```{r results='asis', echo=FALSE}
cat(output$Temperatura)
```
</td><td class="celda2">
```{r results='asis', echo=FALSE}
cat(paste(output$Hora1))
```
</td>
</table>

enter image description here

Upvotes: 0

Views: 247

Answers (1)

drmariod
drmariod

Reputation: 11762

use cat instead! like cat(output$Hora1)

Upvotes: 1

Related Questions