我正在使用以下代码绘制图形:
library (ggplot2)
png (filename = "graph.png")
stats <- read.table("processed-r.dat", header=T, sep=",")
attach (stats)
stats <- stats[order(best), ]
sp <- stats$A / stats$B
index <- seq (1, sum (sp >= 1.0))
stats <- data.frame (x=index, y=sp[sp>=1.0])
ggplot (data=stats, aes (x=x, y=y, group=1)) + geom_line()
dev.off ()
Run Code Online (Sandbox Code Playgroud)

1 - 如何在图中添加垂直线,该垂直线与y的特定值相交(例如2)?
2 - 如何使y轴从0.5开始而不是1?
我在ubuntu 11.10下编译gcc 4.6.2有一个问题.这个错误很流行,即/ usr/bin/ld:找不到crti.o:没有这样的文件或目录我试过LIBRARY_PATH =/usr/lib/x86_64-linux-gnu其中crti.o可以被链接器找到但是然后配置抱怨LIBRARY_PATH在构建gcc时不应包含当前目录的路径
checking LIBRARY_PATH variable... contains current directory
configure: error:
*** LIBRARY_PATH shouldn't contain the current directory when
*** building gcc. Please change the environment variable
*** and run configure again.
make[2]: *** [configure-stage2-gcc] Error 1
make[2]: Leaving directory `/home/abdul/cc02/gcc-4.6.2/src-infra/obj-gcc'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/abdul/cc02/gcc-4.6.2/src-infra/obj-gcc'
Run Code Online (Sandbox Code Playgroud)
我也试过设置LD_LIBRARY_PATH但没有用.
提前致谢.
我做了一个全新的ARCH linux安装,以及R版本2.15.1.但在使用plot命令绘制任何内容后,绘图窗口始终为空(未显示任何内容).可能是司机或其他问题.我尝试过graphics.off()函数,但无济于事.
问题编辑:
然而,在调整绘图窗口大小后,该图可见.
x<-c(1, 2, 3, 4, 5)
y<-c(0.1, 0.3, 0.7, 1.11, 1.3)
plot(x, y)
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
Run Code Online (Sandbox Code Playgroud)
问题编辑:
设置X11.options(type ="nbcairo")工作正常.
这次我不会像以前在我的一个问题中那样直接询问如何检测异常值.我确实阅读了一些与此主题相关的帖子,但没有得到我需要的内容.我有一组值,如下所示:
y<-c(0.59, 0.61, 0.59, 1.55, 1.33, 3.50, 1.00, 1.22, 2.50, 3.00, 3.79, 3.98, 4.33, 4.45, 4.59, 4.72, 4.82, 4.90, 4.96, 7.92, 5.01, 5.01, 4.94, 5.05, 5.04, 5.03, 5.06, 5.10, 5.04, 5.06, 7.77, 5.07, 5.08, 5.08, 5.12, 5.12, 5.08, 5.17, 5.18)
Run Code Online (Sandbox Code Playgroud)
现在,大多数研究人员都表示异常检测过程不仅取决于数据,还取决于背景.我使用了R中的几个包,如异常值(grubbs test),extremevalues,mvoutlier(pcout方法),但无法找到使用它们的最佳方法.在这种情况下(取决于我的要求),7.77(第31号视网膜),7.92(20视点中的视点)和3.50(视图第6组)是异常值.使用异常值包的grubbs测试我可以检测7.77和7.92作为异常值但不是3.50.我不知道我是否可以在这里发布我的数据图,但是在查看了图或分布上的数据趋势之后,观察No 6将是一个明显的异常值.
我试图将非线性模型拟合到这些数据,但由于这些异常值,我找不到最合适的(最佳拟合不是唯一的要求),无论如何我需要检测这些异常值,因为我将适合单独的这些异常值的模型.
我的问题很简单.我是否可以通过一些标准包检测这3个异常值?或者如何使用我的非线性生成模型来帮助检测这些异常值?
最好的祝福
沙赫扎德

我需要一些帮助来确定向量中的多个最小值.我们假设,我有一个向量x:
x<-c(1,10,2, 4, 100, 3)
Run Code Online (Sandbox Code Playgroud)
并且想确定最小的3个元素的索引,即1,2和3.我需要索引,因为我将使用索引来访问另一个向量中的相应元素.当然,排序将提供最小值,但我想知道在排序之前它们的实际发生的索引.
我正在尝试使用以下代码缩放0和1范围内的data.frame:
for(i in 1:nrow(data))
{
x <- data[i, ]
data[i, ] <- scale(x, min(x), max(x)-min(x))
}
Data:
x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17
15 6 6 0 9 3 1 4 5 1 1 13 0 0 20 5 28
2 24 14 7 0 15 7 0 11 3 3 4 15 7 0 30 0 344
3 10 5 2 0 6 2 0 5 0 0 …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用R的adabag包进行分类.
以下调用与R的ada包的ada()函数完美配合.
model<-ada(factor(label)~., data=trainingdata)
Run Code Online (Sandbox Code Playgroud)
但是当在以下adabag函数调用中使用相同的训练数据集时,它会返回错误:
model<-boosting(factor(label)~., data=trainingdata)
Error in `[.data.frame`(data, , as.character(formula[[2]])) :
undefined columns selected
Run Code Online (Sandbox Code Playgroud)
这个错误究竟表明了什么?
我正在编写一个名为nauty的程序.该程序使用规范函数名称getline,它也是标准GNU C库的一部分.
是否有可能在编译时告诉GCC使用这个程序定义的函数?
使用 gcc-5.1.0 编译以下代码会产生警告:
warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration]
Run Code Online (Sandbox Code Playgroud)
代码:
#include <stdio.h>
#include <math.h>
int main (void)
{
printf ("%d\n", abs (-1));
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我用 gcc-4.9.2 编译了相同的代码,它没有产生任何警告。
r ×6
gcc ×3
statistics ×2
adaboost ×1
c ×1
gcc-warning ×1
ggplot2 ×1
linux ×1
outliers ×1
regression ×1
scale ×1
ubuntu ×1