我需要确定75%和99%的单侧尾部的临界t值,对于40个自由度.
以下是双侧99%临界t值的代码:
qt(0.01, 40)
Run Code Online (Sandbox Code Playgroud)
但我怎样才能确定单侧临界t值?
我很困惑为什么箱形图没有在这个情节中订购:
set.seed(200)
x <- data.frame(country=c(rep('UK', 10),
rep("USA", 10),
rep("Ireland", 5)),
wing=c(rnorm(25)))
ggplot(x, aes(reorder(country, wing, median), wing)) + geom_boxplot()
Run Code Online (Sandbox Code Playgroud)

如何根据最高最低中位数(从左到右)订购箱图?
我正在使用该stargazer包输出R数据帧作为乳胶代码:
library(stargazer)
stargazer(mtcars)
Run Code Online (Sandbox Code Playgroud)
这是输出
% Table created by StarGazer v.3.0.1 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Thu, May 09, 2013 - 16:14:28
\begin{table}[htb] \centering
\caption{}
\label{}
\footnotesize
\begin{tabular}{@{\extracolsep{5pt}}l c c c c c }
\\[-1.8ex]\hline
\hline \\[-1.8ex]
Statistic & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{St. Dev.} & \multicolumn{1}{c}{Min} & \multicolumn{1}{c}{Max} \\
\hline \\[-1.8ex]
mpg & 32 & 20.091 & 6.027 & 10.400 & 33.900 \\
cyl & 32 & 6.188 & 1.786 …Run Code Online (Sandbox Code Playgroud) 感觉这应该很简单,但我已经经历过堆栈溢出和combn帮助,但看不到解决方案。
下面的玩家需要组成 3 对 2 的队伍。我需要找到所有可能的队伍组合。例如,两个可能的团队是“Ross”、“Bobby”和“Casper”在一个团队中,“Max”和“Jake”在另一团队中。我该如何编码?
players <- c("Ross", "Bobby", "Max", "Casper", "Jake")
Run Code Online (Sandbox Code Playgroud) 我正在使用来自R内部的Pandoc将降价文档转换为PDF文档.我正在尝试将标题集中在一起.
到目前为止,我已经尝试过:
<center># This is my title</center>
Run Code Online (Sandbox Code Playgroud)
和
-># This is my title<-
Run Code Online (Sandbox Code Playgroud)
但都没有奏效.使用Pandoc从markdown转换为PDF时,有没有办法集中标题?
plyr::mapvalues 可以像这样使用:
mapvalues(mtcars$cyl, c(4, 6, 8), c("a", "b", "c"))
Run Code Online (Sandbox Code Playgroud)
但这不起作用:
mtcars %>%
dplyr::select(cyl) %>%
mapvalues(c(4, 6, 8), c("a", "b", "c")) %>%
as.data.frame()
Run Code Online (Sandbox Code Playgroud)
我怎么plyr::mapvalues用dplyr?甚至更好,dplyr相当于什么?
我有这个命名的矢量:
x <- 1:5
names(x) <- c('0 15', '1 15', '2 15', '0 16', '1 16')
Run Code Online (Sandbox Code Playgroud)
转换x为此数据框的最佳方法是什么:
xDF <- data.frame(V1 = c(0, 1, 2, 0, 1), V2 = c(15, 15, 15, 16, 16), V3 = 1:5)
Run Code Online (Sandbox Code Playgroud) 该ggplot2附加软件包,cowplot具有用来绘制多条曲线称为一个不错的功能plot_grid().这是plot_grid()在行动:
library(ggplot2); library(cowplot)
plot_a <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
plot_b <- ggplot(mtcars, aes(mpg, disp)) + geom_point()
plot_grid(plot_a, plot_b, labels = c("A", "B"))
Run Code Online (Sandbox Code Playgroud)
但请注意加载如何cowplot更改默认的绘图样式.如何加载cowplot包以便我可以使用该plot_grid()功能,但也禁用cowplot强制执行的默认打印样式?
我有这样的日期列表:
library(lubridate)
my.dates <- c("03-01-2006", "28-01-2006", "12-01-2008", "02-02-2006", "03-03-2008")
my.dates <- dmy(my.dates)
Run Code Online (Sandbox Code Playgroud)
我需要从下面的每个日期中提取一年中的日期编号,其中1月1日是第1天:
day.number <- c(3, 28, 12, 33, 62)
Run Code Online (Sandbox Code Playgroud)
我有一个很好的搜索谷歌和SO,但无法找到一个简单的方法来做到这一点.帮助表示感谢,谢谢.
如果我跑
knit2pdf("test.Rnw")
Run Code Online (Sandbox Code Playgroud)
... knitr在R中使用.Rnw文件,我收到此错误:
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet, :
Running 'texi2dvi' on 'test.tex' failed.
Run Code Online (Sandbox Code Playgroud)
谁知道我怎么解决?