No matter what I do, Rstudio tells me that "type is obsolete"

When I try to plot something (anything) I receive this message:

>plot(GRAPHING_FST_JUZ_BLV_noUN$CHROM,GRAPHING_FST_JUZ_BLV_noUN$Fst, type = "p")

>Error in rect() : argument "xleft" is missing, with no default
In addition: Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
  graphical parameter "type" is obsolete
2: In doTryCatch(return(expr), name, parentenv, handler) :
  graphical parameter "type" is obsolete

My data is simple numbers and there are no NA's or characters

str(GRAPHING_FST_JUZ_BLV_noUN)

lasses ‘loci’ and 'data.frame':	964 obs. of  5 variables:
 $ Fit  : Factor w/ 200 levels "-0.507294415247399",..: 117 199 9 14 199 199 199 199 200 199 ...
 $ Fst  : Factor w/ 396 levels "-0.121495327102804",..: 56 22 182 289 31 189 298 273 396 379 ...
 $ Fis  : Factor w/ 176 levels "-0.694117647058825",..: 131 175 15 7 175 175 175 175 176 175 ...
 $ CHROM: Factor w/ 14 levels "chr00","chr01",..: 11 11 8 6 7 9 2 5 5 13 ...
 $ POS  : Factor w/ 1000 levels "   107727","   127791",..: 333 10 434 397 706 810 761 954 166 732 ...
 - attr(*, "locicol")= int  1 2 3 4 5

When I do anything in Rstudio, I receive this message:

Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
  graphical parameter "type" is obsolete
2: In doTryCatch(return(expr), name, parentenv, handler) :
  graphical parameter "type" is obsolete

I would have to know more about RStudio internals than I do or ever will to explain the messages, so I've run code with random numeric objects in a dataframe

> x <- sort(rnorm(47))
> y <- sort(rnorm(47))
> plot(x,y)
> CHROM <- x
> Fst <- y
> GRAPHING_FST_JUZ_BLV_noUN <- as.data.frame(cbind(CHROM,Fst))
> head(GRAPHING_FST_JUZ_BLV_noUN)
      CHROM       Fst
1 -2.547468 -2.174413
2 -1.774497 -2.142001
3 -1.526069 -1.903299
4 -1.482865 -1.721827
5 -1.387847 -1.704770
6 -1.361492 -1.630904
> plot(GRAPHING_FST_JUZ_BLV_noUN$CHROM,GRAPHING_FST_JUZ_BLV_noUN$Fst, type = "p")

without problem.

So then, I converted the arguments to factors

> CHROM <- factor(x)
> Fst <- factor(y)
> GRAPHING_FST_JUZ_BLV_noUN <- as.data.frame(cbind(CHROM,Fst))
> 
> plot(GRAPHING_FST_JUZ_BLV_noUN$CHROM,GRAPHING_FST_JUZ_BLV_noUN$Fst, type = "p")

Again, no problem.

However, treating the argument as character type reproduces your problem

> CHROM <- as.character(x)
> Fst <- as.character(y)
> GRAPHING_FST_JUZ_BLV_noUN <- as.data.frame(cbind(CHROM,Fst))
> plot(GRAPHING_FST_JUZ_BLV_noUN$CHROM,GRAPHING_FST_JUZ_BLV_noUN$Fst, type = "p")
Warning message:
In rect(xleft, ybottom, xright, ytop, col = col, ...) :
  graphical parameter "type" is obsolete

So, I suspect your source data may have been in CSV form with at least one numeric column "Fst", say, in quotes.

That gave me a lot of insight and I got it working again. Thanks, boss!

Best,

H

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.