我试图将我的所有数据运算转移到Rmarkdown而不是SPSS + Excel,但无法弄清楚如何创建带有附加图的表.
在Excel中,这可以使用迷你图功能完成,或者像我一样,只需创建一个图表并非常准确地放置它.
上表是使用Tables包(和Pander)中的表格函数创建的.并粘贴到Excel中以创建图形(以及图形的标题).
library(tables)
library(pander)
pander( #convert table to rmarkdown table
tabular(
(Species + 1) ~ (n=1) + Format(digits=2) *
(Sepal.Length + Sepal.Width) * (mean + sd),
data = iris),
caption = "Table 1. Iris") #Heading for table
Run Code Online (Sandbox Code Playgroud)
有没有人创造过这样的东西?也许使用gridExtra包解决方法,虽然我怀疑包可以匹配表和图.
编辑 - 迄今为止的解决方案.
HTML已完成.在那里用pdf中途.对于doc,我认为不可能(复制粘贴到Excel).
HTML表
首先,所以R知道我是否正在渲染html,pdf或doc.out_type取值:"html","pdf"和"docx".我可以在if语句中使用这个对象.
out_type <- knitr::opts_knit$get("rmarkdown.pandoc.to")
Run Code Online (Sandbox Code Playgroud)
现在吧:
if(out_type == "html"){ #if output is html then:
my_table$Mean_Sepal_Length <- paste0( #I have a table saved as a dataframe. I add a column to it called Mean_Sepal_Length
"<span style=' …
Run Code Online (Sandbox Code Playgroud) 我一直在网上搜索一段时间来回答我的问题.我想将div背景颜色扩展到div(以及容器div)之外,以便达到浏览器的宽度.像这样http://vinnusal.is/ 上面的例子的问题是我使用填充/边距修复,它创建一个恼人的滚动到右边.我试过溢出没有任何运气.
我知道这可以通过100%的容器div和更小的嵌套div来完成.但是,如果可能的话,我想用另一种方式,因为这是我在流体站点的第一次射击,其中包括所有并发症.
在此先感谢Helgi
这是HTML标记:
<body>
<div class="gridContainer clearfix"> <!-- Container -->
<div class="gridContainer clearfix header" id="header"> <!--Header begins-->
<img src="pics/hvitt.png" alt="VFI Logo" name="logo" id="logo">
<!-- Menu Horizontal -->
... irrelevant markup for menu...
</div>
<!-- Header ends -->
<div class="gridContainer clearfix submenu" id="submenu"> <!-- Submenu begins -->
<h1><!-- InstanceBeginEditable name="title" -->Articles<!-- InstanceEndEditable --></h1>
Run Code Online (Sandbox Code Playgroud)
而CSS:
/* Mobile Layout: 480px and below. */
.gridContainer {
margin-left: auto;
margin-right: auto;
width: 88.626%;
padding-left: 1.1869%;
padding-right: 1.1869%;
}
#LayoutDiv1 {
clear: both; …
Run Code Online (Sandbox Code Playgroud) 我一直在拼命寻找一种计算多重相关矩阵的方法,在R中具有显着性.如果这很难,那么两个具有重要性的变量之间的多重相关就足够了.
到目前为止我尝试了什么:
library(polychor)
poly <- polychor(var1,var2)
poly <- polychor(DatM) #where DatM is a DF converted to matrix
library(polycor)
hetcor(Dat2) #I am however uncertain hetcor is something I would want if I am looking for polychoric correlation.
library(psych)
polychoric(Dat$for2a,smooth=TRUE,global=TRUE,polycor=FALSE, ML = FALSE, std.err=TRUE)
Run Code Online (Sandbox Code Playgroud)
这些都不具有重要意义.我已经读过,对于每个相关对的corr = 0假设,置换检验[可以给我意义] [1].包硬币和lmPerm允许人们计算排列测试.但是,我不确定如何.
先谢谢,Helgi
When plotting percentages and a column is at 100%, the value label gets cut of from the graph.
Two possible solutions to this are:
1. scale_y_continuous(limits = c(0, 1.1)
2. scale_y_continuous(expand = c(0, 0, 0.2, 0)
But both solutions expand the axis. I would prefer to just add a padding/margin so that I don't get a long line above 100%. Is this possible?
Working example
library(ggplot2)
library(magrittr)
data.frame("value" = c(0, 0.5, 1),
"v1" = letters[1:3]) %>%
ggplot(aes(x = v1,
y …
Run Code Online (Sandbox Code Playgroud) r ×3
graph ×2
correlation ×1
css ×1
ggplot2 ×1
knitr ×1
r-markdown ×1
significance ×1
sparklines ×1