Home > OS >  R language error
R language error

Time:11-27

> Setwd (" C: \ \ Users \ \ Administrator \ \ Desktop \ \ 24 clinicalCor ")
Rt=read. Table (inputFile, sep="\ t", the header=t, check the names=F) # read input file
ClinicalNum=7 # define clinical character number
Whether pFilter=0.05 # drawing filter criteria

Prints tabular and graphic results # clinical correlation analysis,
OutTab=data frame (gene=colnames (rt [(clinicalNum + 2), ncol (rt)]))
For (clinical in colnames (rt [2 + 1) : (clinicalNum])) {
+ xlabel=vector ()
+ tab1=table (rt [, clinical])
+ labelNum=length (tab1)
+ dotCol=c (" blue ", "red")
+ the if (labelNum==3) {
+ dotCol=c (2 and 4)
+}
+ the if (labelNum==4) {
+ dotCol=c (2, 5-tetrafluorobenzoic)
+}
+ the if (labelNum> 4) {
+ dotCol=rainbow (labelNum)
+}
+ the for (I in 1: labelNum) {
+ xlabel=c (xlabel, names (tab1 [I]))
+}
+ clinicalPvalVector=c ()
+ the for (I in colnames (rt [(clinicalNum + 2), ncol (rt)])) {
+ rt1=rbind (expression=rt [, I], clinical=rt [, clinical])
+ rt1=as matrix (t (rt1))
+ the if (labelNum==2) {
+ cliTest<- t.t est (expression to clinical, data=https://bbs.csdn.net/topics/rt1)
+} else {
+ cliTest<- kruskal. Test (expression to clinical, data=https://bbs.csdn.net/topics/rt1)}
+ pValue=https://bbs.csdn.net/topics/cliTest$p.value
+ stat=round (cliTest $statistic, 3)
+ pval=0
+ the if (pValue<0.001) {
+ pval=signif pValue, (4)
+ pval=format (pval, scientific=TRUE)
+} else {
+ pval=sprintf (%.03 "f", pValue)
+}
+ clinicalPvalVector=c (clinicalPvalVector paste0 (stat, "(", pval,") "))
+ the if (pValueA + b=boxplot (expression to clinical, data=https://bbs.csdn.net/topics/rt1, the outline=FALSE, the plot=F)
+ yMin=min (b $stats)
+ yMax=Max ($stats/5 b + b $stats)
+ n=ncol (b $stats)
+ outPdf=paste0 (I, "", clinical," PDF ")
+ PDF file=outPdf, width=7, height=5)
+ par (mar=c (4.5, 6 filling))
+ ylab=ifelse (I=="riskScore", "Risk score", "Gene expression")
+ boxplot (expression to clinical, data=https://bbs.csdn.net/topics/rt1, names=xlabel,
+ ylab=ylab, main=paste0 (I, "(p=", pval, ") "), the xlab=clinical,
+ cex. Main=1.4, cex. Lab=1.4, cex. Axis=1.3, ylim=c (yMin, yMax), the outline=FALSE)
+ beeswarm (expression to clinical, data=https://bbs.csdn.net/topics/rt1, col=dotCol, LWD=0.1,
PCH +=16, add=TRUE, corral="wrap")
+ dev. Off ()
+}
+}
+ outTab=cbind (outTab, clinicalPvalVector)
+}
The Error in the if (stderr & lt; Eps * 10 *. The Machine $double. Max (abs (mx), abs (my))) stop (" data are essentially constant ") :
Need to TRUE/FALSE value can not use the lack of value
In addition, Warning messages:
1: In scheme. The default (x) : argument is not numeric or logical: returning NA
2: In scheme. The default (y) : argument is not numeric or logical: returning NA
Colnames (outTab)=c (" id ", colnames (rt [2 + 1) : (clinicalNum]))
The Error in names (x) & lt; - the value: the length of the 'names' properties [8] required and the length of the vector [1] as
Write. The table (outTab, file="clinicalCor. XLS", sep="\ t", row. Names=F, quote=F)

The above is the script
The data is:
Id the age grade stage T M N HSP90AB1 MAP2K7 TBK1 VAMP7 DNAJB1 ATG5 GABARAPL2 riskScore
TCGA - VR - A8EO & lt;=65 G1-2 Stage I& II T3-4 M0 N0 9.85772070349287 3.410769808467 2.71489119710381 4.78553039990027 6.92241877104248 3.5008407160015 4.01999809636905 2.11711815629978
TCGA Z6 - A8JD & lt;=65 G3-4 stages I& II T3-4 M0 N0 9.16949212799578 3.48978182369592 2.52814194694367 4.09671304643945 8.19368452866279 2.91494829820787 3.78880053705284 0.614947043988963
TCGA - L5 - A4OX & gt; G3 65-4 stages I& II T1-2 M0 N1-3 9.19447271892246 3.09424958449011 3.47628187502368 4.66724838754228 7.74573750879616 3.6577737512425 3.54538648005706 3.57354236310584
I don't know how to solve, I want to ask you a great god
  • Related