我有以下文档,我试图用Rstudio编译:
---
title:
shorttitle:
author:
bibliography:
- library.bib
output: papaja::apa6_pdf
---
```{r message = FALSE, warning = FALSE}
library("papaja")
apa_prepare_doc() # Prepare document for rendering
```
# Introduction
@Bakan1966
# References
```{r create_r-references}
r_refs(file = "r-references.bib")
```
Run Code Online (Sandbox Code Playgroud)
当我运行knit时,它会编译.md文件,但是pandoc会出错:
pandoc-citeproc: "stdin" (line 232, column 2):
unexpected "a"
expecting "c", "C", "p", "P", "s" or "S"
pandoc: Error running filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc
Error: pandoc document conversion failed with error 83
In addition: Warning messages:
1: In yaml::yaml.load(enc2utf8(string), ...) :
NAs introduced by coercion: …
Run Code Online (Sandbox Code Playgroud) 我有以下形式的数据:
set.seed(1234)
data <- data.frame(cbind(runif(40,0,10), rep(seq(1,20,1), each = 2)))
data <- data[sample(nrow(data)),]
colnames(data) <- c("obs","subject")
head(data)
obs subject
1.5904600 12
8.1059855 13
5.4497484 6
0.3999592 12
2.5880982 19
2.6682078 9
... ...
Run Code Online (Sandbox Code Playgroud)
假设我只有两个观察点(列"障碍")按主题(列"主题",其中主题从1到20编号).
我想按"主题"列的值"分组"行.更准确地说,我想按主题"订购"数据,但保留上面显示的顺序.因此,最终数据将是这样的:
obs subject
1.5904600 12
0.3999592 12
8.1059855 13
2.3656473 13
5.4497484 6
7.2934746 6
Run Code Online (Sandbox Code Playgroud)
有任何想法吗 ?我想到可能会识别出与主题相对应的每一行which
:
which(data$subject==x)
Run Code Online (Sandbox Code Playgroud)
然后rbind
循环中的这些行,但我相信有一个更简单,更快的方法来做到这一点,不是吗?
我最近将一个包含R包的github存储库连接到Travis CI。使用R的当前发行版(release
)和开发发行版(devel
),该软件包可以正常运行,但是旧版本(oldrel
即R版本3.2.5)给出了错误。
生成不会引发错误,但是会终止,并显示以下消息:
No output has been received in the last 10m0s, this potentially indicates
a stalled build or something wrong with the build itself.
The build has been terminated
Run Code Online (Sandbox Code Playgroud)
可以在以下位置找到最新版本:https : //travis-ci.org/lnalborczyk/ESTER
我的.travis.yml
文件是:
language: R
sudo: false
cache: packages
r:
- oldrel
- release
- devel
Run Code Online (Sandbox Code Playgroud)
有人知道这个问题的根源吗?从提交给CRAN的角度来看,这种行为是否会引起问题?
我知道这travis_wait
可以延长构建时间,但是并不能解释为什么该软件包实际上在当前版本和开发版本上可以正常构建(大约500万),而不能在R的旧版本上构建(请参阅下面的评论) )。
我正在使用 bookdown 包和 memoir latex 类写我的论文。当我导出为 pdf 或 html 时,一切都相对正常,但我无法将论文导出为 word 文档...
我收到以下神秘错误:
Error in files2[[format]] :
attempt to select less than one element in get1index
Run Code Online (Sandbox Code Playgroud)
但是,很难提供可重复的示例,因为我正在使用凌乱的论文存储库工作。
但这是我的 _output.yml 文件(的一部分):
bookdown::pdf_book:
includes:
in_header: latex/preamble.tex # defines style and latex options
before_body: latex/before_body.tex # defines cover page
latex_engine: xelatex # lualatex or xelatex
citation_package: none # needs to be "none" in order to use the csl file
keep_tex: true # keeps the .tex file
dev: "cairo_pdf"
toc: false # deactivates default …
Run Code Online (Sandbox Code Playgroud) 假设我有以下方程组:
a * b = 5
sqrt(a * b^2) = 10
Run Code Online (Sandbox Code Playgroud)
如何在R中解决a和b的这些方程?
我想这个问题可以说是一个优化问题,具有以下功能......?
fn <- function(a, b) {
rate <- a * b
shape <- sqrt(a * b^2)
return(c(rate, shape) )
}
Run Code Online (Sandbox Code Playgroud)