我想追加或添加一个data.frame给自己...就像添加一样:
n <- n + t
Run Code Online (Sandbox Code Playgroud)
我有一个创建data.frame的函数.
我一直在使用:
g <- function(compareA,compareB) {
for (i in 1:1000) {
ttr <- t.test(compareA, compareA, var.equal = TRUE)
tt_pvalues[i] <- ttr$p.value
}
name_tag <- paste(nameA, nameB, sep = "_Vs_")
tt_titles <- data.frame(name_tag, tt_titles)
# character vector which I want to add to a list
ALL_pvalues <- data.frame(tt_pvalues, ALL_pvalues)
# adding a numeric vector of values to a larger data.frame
}
Run Code Online (Sandbox Code Playgroud)
会cbind更好吗?
我不喜欢ESS(Emacs Speaks Statistics)模式中评论的自动缩进,因为它是向右到目前为止.
normalize <- function(values){
# comment
return(2* values / (max(values) - min(values)) )
}
Run Code Online (Sandbox Code Playgroud)
Python还使用docstrings进行注释.我在R里玩它.
normalize <- function(values){
"comment
line 2 of comment"
return(2* values / (max(values) - min(values)) )
}
Run Code Online (Sandbox Code Playgroud)
我相信我也可以修复评论的ESS缩进,但我喜欢多行评论的想法.GNU R中的docstrings是否有任何缺点?
我想为我的R代码创建文档.代码是R项目的一部分,但不是包的一部分.有没有一种方法可以使用内置的帮助查看器显示不在包中的代码的文档,而无需创建完整的包?
我有一些我想要可视化的序列特征信息.这是一些玩具数据(最后重新生成数据的具体r代码)
type index variable position
...
14 CDS 14 start 31129
15 exon 15 start 32196
16 CDS 16 start 32196
17 stop_codon 17 start 32247
18 exon 1 end 12166
19 CDS 2 end 12166
...
Run Code Online (Sandbox Code Playgroud)
我用来生成以下图的命令是
qplot(position,type,data=m2data,color=type)+xlim(11950,15000)
Run Code Online (Sandbox Code Playgroud)

但是我想在"开始"和"结束"之间添加线段,这些线段与下面共享相同的"索引",这是我用油漆制作的.

如何用R中的ggplot2实现这个目标?
以下是数据
m2data<-structure(list(type = structure(c(2L, 1L, 3L, 2L, 1L, 2L, 1L,
4L, 2L, 2L, 1L, 3L, 2L, 1L, 2L, 1L, 4L, 2L, 1L, 3L, 2L, 1L, 2L,
1L, 4L, 2L, 2L, 1L, 3L, 2L, 1L, 2L, 1L, 4L), class = …Run Code Online (Sandbox Code Playgroud) 在编写Rhtml文档时,您可以利用<!--rinline x -->在Rhtml文档中编写内联代码.但是,此代码包含在<code class="inline knitr">x</code>其中可能破坏基本格式的破坏.
有没有办法完全删除它?这样只会x写入文档.
我无法在 R 中安装任何软件包。我尝试了从 3.2.2 到 3.2.4(修订版)的所有 R 版本,但出现了相同的错误。当我连接到我的大学防火墙时,这对我来说似乎是一个代理问题。当我连接到家庭网络时,我能够安装这些软件包。您能指导我解决此问题吗?\n以下是错误消息
\n\n> chooseCRANmirror()\nError in download.file(url, destfile = f, quiet = TRUE) : \n cannot open URL \'https://cran.r-project.org/CRAN_mirrors.csv\'\nIn addition: Warning message:\nIn download.file(url, destfile = f, quiet = TRUE) :\n InternetOpenUrl failed: \'The server name or address could not be resolved\'\n> install.packages("ggplot2")\nInstalling package into \xe2\x80\x98C:/Users/HP/Documents/R/win-library/3.2\xe2\x80\x99\n(as \xe2\x80\x98lib\xe2\x80\x99 is unspecified)\nWarning: unable to access index for repository https://cran.rstudio.com/src/contrib\nWarning: unable to access index for repository \nWarning: unable to access index for repository \nWarning: unable to access index for …Run Code Online (Sandbox Code Playgroud) 我使用以下代码绘制了值:
png(filename="q.png", width=3000, height=1600, units="px")
Run Code Online (Sandbox Code Playgroud)
但是x和y轴上的值似乎太小了.我想放大它们.我怎么做?
我们一直在尝试在redhat linux机器上安装RQuantLib.经过一个月(令人尴尬的长时间!)的反复试验,我们成功地编译了最新版本的boost和quantlib.我根本不是Linux专家,因此在运行install.packages("RQuantLib")时调试编译标志时遇到一些麻烦.Rcpp已经安装并且工作正常.
以下错误消息详细说明了该问题.我很困惑,因为我认为它应该需要的文件(libQuantLib.so.0)存在于/ usr/local/lib中.很抱歉,这很可能是一个愚蠢的问题,但我认为我们非常接近在Linux上访问R中的quantlib.
错误消息如下:
g++ -I/apps/R/R-3.0.0/include -DNDEBUG -I/usr/local/include -I"/apps/R/R-3.0.0/library/Rcpp/include" -g -O2 -I/usr/local/include -I/usr/loca
l/include/boost -I. -fpic -g -O2 -c zero.cpp -o zero.o
g++ -shared -L/usr/local/lib64 -o RQuantLib.so asian.o barrier_binary.o bermudan.o bonds.o calendars.o curves.o daycounter.o discount.o hullwhi
te.o implieds.o utils.o vanilla.o zero.o -L/apps/R/R-3.0.0/library/Rcpp/lib -lRcpp -Wl,-rpath,/apps/R/R-3.0.0/library/Rcpp/lib -L/usr/local/lib
-L/usr/local/lib -lQuantLib
installing to /apps/R/R-3.0.0/library/RQuantLib/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be …Run Code Online (Sandbox Code Playgroud) 我已经将我的android库上传到https://bintray.com并将其与Jcenter存储库http://jcenter.bintray.com/相关联.现在我想从JCenter存储库中删除此库.我怎样才能做到这一点?