我一直在尝试在 R 中创建一个 qq 图。我很难使用我的结果,所以我尝试遵循“遗传病例对照研究中的基本统计分析,Clarke 等人”中的示例。
步骤 5, a, iii) 我已将路径和模型替换为必填字段,如下所示:
data<-read.table("C:\Users\X\Desktop\BIOM3006\Alternate/data.assoc.logistic",header=TRUE);pdf("C:\Users\X\Desktop\BIOM3006\Alternate/pvalue.qq.plot.pdf");
obs<-−log10(sort(data[data$TEST=="ADD",]$P));exp<-−log10(c(1:length(obs))/(length(obs)+ 1));plot(exp,
obs<-ylab="Observed(−logP)",xlab="Expected(−logP)",ylim=c(0,20),xlim=c(0,7)) lines(c(0,7),c(0,7),col=1,lwd=2);dev.off()
这是我收到的错误消息:
data<-read.table("C:\Users\Tom\Desktop\BIOM3006\Alternate/data.assoc.logistic",header=TRUE);pdf("C:\Users\Tom\Desktop\BIOM3006\Alternate/pvalue.qq.plot.pdf");
Error: '\U' used without hex digits in character string starting ""C:\U"
obs<-−log10(sort(data[data$TEST=="ADD",]$P));exp<-−log10(c(1:length(obs))/(length(obs)+ 1));plot(exp,
Error in log10(sort(data[data$TEST == "ADD", ]$P)) :
non-numeric argument to mathematical function
In addition: Warning message:
In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'
obs<-ylab="Observed(−logP)",xlab="Expected(−logP)",ylim=c(0,20),xlim=c(0,7))
Error: unexpected ',' in "obs<-ylab="Observed(-logP)","
lines(c(0,7),c(0,7),col=1,lwd=2)
Error in plot.xy(xy.coords(x, y), type = type, ...) :
plot.new has not been called yet
;dev.off()
Error: unexpected ';' in ";"
我仍然在掌握这个软件,所以如果我忽略了一些明显的东西,任何帮助都将不胜感激和抱歉。汤姆