相关疑难解决方法(0)

调整R Markdown HTML输出的输出宽度

我正在生成HTML输出,但我遇到R代码输出的输出宽度问题.

我能够毫无困难地调整图形宽度,但是当我尝试编写数据表或因子载荷时,R输出的固定宽度仅为我屏幕宽度的三分之一左右.这导致表的列被拆分而不是单个表中显示的所有列.

这是一个可重复的例子:

---
output: html_document
---

# Title

```{r echo = FALSE, fig.width=16, fig.height=6}
x = matrix(rnorm(100),ncol=10)
x
plot(x)
```
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

knitr r-markdown

57
推荐指数
2
解决办法
5万
查看次数

knitr:如何防止输出中的文本换行?

编织到HTML时,我遇到了knitr中代码输出块中的文本换行问题.

例如,如果我运行以下内容:

matrix(rnorm(60, 5, 2), ncol = 12)
Run Code Online (Sandbox Code Playgroud)

HTML中的输出将包装表,给出这样的输出,其中第12列在其余部分下移动:

##       [,1]   [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10] [,11]
## [1,] 3.407 0.8035 2.981 5.269 6.989 5.107 7.143 3.127 3.624 7.220 4.805
## [2,] 3.907 5.5971 5.488 4.995 6.496 5.980 1.576 3.009 6.605 3.440 2.754
## [3,] 1.945 3.7668 4.860 2.945 3.663 5.945 7.168 2.012 5.873 8.190 7.441
## [4,] 4.893 6.2054 4.403 3.967 2.880 7.196 1.813 3.283 5.216 5.699 2.829
## [5,] 5.706 0.9084 5.802 1.404 3.122 …
Run Code Online (Sandbox Code Playgroud)

r knitr

43
推荐指数
1
解决办法
2万
查看次数

固定高度的bootstrap可预滚动DIV

在我的应用程序中,我必须为数据库记录显示bootsatarp网格.由于记录数量足以在没有完整页面滚动的情况下查看,因此我使用bootstrap pre-scrollable div包装我的表,它为我提供了滚动表格的功能.但是,所有时间DIV大小都是浏览器窗口的一半.我尝试了几乎每个堆栈溢出的帖子和建议,只是它们不适合我.我也试图通过支持java脚本解决这个问题,但也失败了.

这是我的HTML代码

<div class="col-md-9">
<div  class="pre-scrollable">
<table class="table table-bordered table-hover header-fixed"  id="sometable">
                    <thead>
                  <tr>
                    <th>EMP_No</th>
                    <th>Name</th>
                    <th>Designation</th>
                    <th>Department</th>
                    <th>Type</th>
                    <th>#Days</th>
                    <th>Start Date</th>
                    <th>End Date</th>
                    <th>Half day</th>
                    <th>Status</th>
                  </tr>
                </thead>
                <tbody>
                </tbody>
                <?php  //php code for print the table
                 ?>
</div>      
</div>
Run Code Online (Sandbox Code Playgroud)

我用PHP代码的结果在表格上填充.我不知道如何将这个DIV的高度设置为浏览器windows的固定值或全值.下面是使用的CSS

<style>
table {
    font-family: arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
}
td, th {
    border: 1px solid #dddddd;
    text-align: center;
    padding: 1px;
}
thead th {
    text-align: center;
    background-color: #3498db;
}
tr:nth-child(even) {
    background-color: #dddddd;
} …
Run Code Online (Sandbox Code Playgroud)

javascript css php html5 twitter-bootstrap-3

8
推荐指数
3
解决办法
2万
查看次数

标签 统计

knitr ×2

css ×1

html5 ×1

javascript ×1

php ×1

r ×1

r-markdown ×1

twitter-bootstrap-3 ×1