尝试从ioslides演示文稿更改标题页的默认文本大小但失败:
---
title: "My title is a bit too long to fully fit on the title page. I would really like to alter the font size to provide a better fit. I have limited CSS skills to do so"
author: "My Name"
date: "29 March 2016"
output:
ioslides_presentation:
css: slide.css
---
## R Markdown
This is an R Markdown presentation.
Run Code Online (Sandbox Code Playgroud)
我的style.css文件是:
h1 { font-size: 12px;}
Run Code Online (Sandbox Code Playgroud)
knitr使用法兰克福主题制作投影仪幻灯片时,PDF 输出包括带有节和小节名称的幻灯片。
---
title: Movies
author: Chewy
output:
beamer_presentation:
slide_level: 3
theme: "Frankfurt"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
#Introduction
##Background
###History
A long time ago ...
###History
... in a galaxy far far away
#The End
##This the end
### My only friend, the end
Run Code Online (Sandbox Code Playgroud)
给出这个输出...
幻灯片 1-4:
幻灯片 5-8:
如何去掉带有节和小节标题的幻灯片(2、3、6 和 7),同时保持幻灯片顶部显示的文档结构?
我试图找到一种方法来使用管道从数据框(值之一,名称之一)中的两列创建命名向量.到目前为止,我有以下(使用mtcars示例数据)...
library(tidyverse)
x <- mtcars %>%
rownames_to_column("car") %>%
select(car, mpg)
pull(mpg)
names(x) <- row.names(mtcars)
x
# Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive Hornet Sportabout
# 21.0 21.0 22.8 21.4 18.7
# Valiant Duster 360 Merc 240D Merc 230 Merc 280
# 18.1 14.3 24.4 22.8 19.2
# Merc 280C Merc 450SE Merc 450SL Merc 450SLC Cadillac Fleetwood
# 17.8 16.4 17.3 15.2 10.4
# Lincoln Continental Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla …Run Code Online (Sandbox Code Playgroud) R中是否有函数可以在多个向量(不同长度)中查找公共字符.例如,如果我有3个向量...
a1 <- LETTERS[1:7]
a2 <- LETTERS[4:8]
a3 <- LETTERS[2:10]
Run Code Online (Sandbox Code Playgroud)
我能想到一个凌乱的解决方案......
intersect(intersect(a1,a2),a3)
Run Code Online (Sandbox Code Playgroud)
问题是,我有大约8或9个向量.有更好的方法吗?
有一点精神障碍.我确信我找到了一个函数来在一个for循环中打印迭代数,这个循环不是print也不是cat,但是给出了与下面的cat相同的输出.
> for(i in 10^(1:5)) print(i)
[1] 10
[1] 100
[1] 1000
[1] 10000
[1] 1e+05
> for(i in 10^(1:5)) cat(i, "\n")
10
100
1000
10000
1e+05
Run Code Online (Sandbox Code Playgroud)
我在打印机和cat的R帮助文件中看不到任何对它的引用.谷歌搜索它,但没有到达任何地方.
我有一组模拟的增长率,比如8个时间段(以及5个模拟的增长路径),
r <- matrix(rnorm(40,0.05,0.01),5,8)
r
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 0.04229559 0.02846659 0.04948458 0.06144443 0.05657848 0.05782358 0.05545835 0.04090866
[2,] 0.06270360 0.06045967 0.04213729 0.05413941 0.06291148 0.05382643 0.05844549 0.03824342
[3,] 0.07846056 0.05503713 0.06800700 0.05888937 0.05759237 0.03789024 0.05250413 0.05011601
[4,] 0.04248757 0.04632404 0.04199074 0.04542522 0.03473972 0.04129197 0.06614095 0.06024244
[5,] 0.04382759 0.03555406 0.06630673 0.06019894 0.05057905 0.06336362 0.04954486 0.05092946
Run Code Online (Sandbox Code Playgroud)
然后,我想使用这些费率进行投影x_{t+1} = x_{t} (1+r_{t}).我可以用for循环来做到这一点,
x.fn<-function(x,rr){
xx<-cbind(x,rr)
for(i in 1:ncol(rr)){
xx[,i+1]<-xx[,i]*(1+rr[,i])
}
xx
}
x.fn(x=100, rr=r)
x
[1,] 100 …Run Code Online (Sandbox Code Playgroud) 两部分正态分布是否存在密度函数:

在克兰上?我想在编写代码之前先检查一下。我检查了分发任务视图。它没有在那里列出。我查看了几个可能的软件包,但无济于事。
更新:我已将dsplitnorm、psplitnorm和qsplitnorm函数添加rsplitnorm到fanplot包中。
我想减少长轴标签之间的空间.我基于我应该使用的R图形lheight,但似乎对ggplot没有影响.有ggplot等价吗?
玩具示例显示问题:
library("tidyverse")
df0 <- mtcars %>%
rownames_to_column("car") %>%
mutate(car = str_wrap(car, width = 10))
ggplot(data = df0, aes(x = car, y = mpg)) +
geom_bar(stat = "identity") +
coord_flip()
# has no effect
par(lheight = 0.5)
ggplot(data = df0, aes(x = car, y = mpg)) +
geom_bar(stat = "identity") +
coord_flip()
Run Code Online (Sandbox Code Playgroud)
我正在尝试在A4风景PDF上获得一张完整的世界地图.当我使用以下内容时
pdf("temp.pdf", paper="a4r")
#par(mar=rep(0,4))
map("world", mar = rep(0,4))
dev.off()
Run Code Online (Sandbox Code Playgroud)
我明白了

我似乎无法得到填充页面的情节.有小费吗?
对于两个分类变量的每个交叉分类,我有五个数据点.我试图在误差条之间添加一些均匀的间距,这样它们就不会在刻面的ggplot2图中重叠,但是会失败.数据很像这样......
library(ggplot2)
library(dplyr)
df0 <- iris %>%
group_by(Species) %>%
mutate(long_sepal = ifelse(Sepal.Length > mean(Sepal.Length),
yes = "long", no = "short")) %>%
group_by(Species, long_sepal) %>%
mutate(petal_rank = order(Petal.Width)) %>%
filter(petal_rank <= 5)
> df0
# Source: local data frame [30 x 7]
# Groups: Species, long_sepal [6]
#
# Sepal.Length Sepal.Width Petal.Length Petal.Width Species long_sepal petal_rank
# (dbl) (dbl) (dbl) (dbl) (fctr) (chr) (int)
# 1 5.4 3.9 1.7 0.4 setosa long 1
# 2 4.6 3.4 1.4 0.3 setosa short …Run Code Online (Sandbox Code Playgroud) r ×10
ggplot2 ×2
knitr ×2
r-markdown ×2
beamer ×1
cran ×1
css ×1
distribution ×1
dplyr ×1
facet-wrap ×1
for-loop ×1
latex ×1
line-breaks ×1
pdf ×1
rstudio ×1
statistics ×1
vector ×1