[R] error while plotting

Nair, Murlidharan T mnair at iusb.edu
Tue Sep 29 21:15:24 CEST 2009



-----Original Message-----
From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de] 
Sent: Tuesday, September 29, 2009 4:52 AM
To: Nair, Murlidharan T
Cc: r-help at r-project.org
Subject: Re: [R] error while plotting



Nair, Murlidharan T wrote:
> 
> -----Original Message-----
> From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de] 
> Sent: Sunday, September 27, 2009 1:17 PM
> To: Nair, Murlidharan T
> Cc: r-help at r-project.org
> Subject: Re: [R] error while plotting
> 
> 
> 
> Nair, Murlidharan T wrote:
>> I am getting the following errors when I am trying to plot the data below. I cannot figure out the error.
>> Error in plot.window(...) : need finite 'xlim' values
>> In addition: Warning messages:
>> 1: In min(x) : no non-missing arguments to min; returning Inf
>> 2: In max(x) : no non-missing arguments to max; returning -Inf
>> 3: In min(x) : no non-missing arguments to min; returning Inf
>> 4: In max(x) : no non-missing arguments to max; returning -Inf
>>
>>
>> #I am using the following code
>> #======================================================
>> library(multcomp)
>> sig.data<-structure(list(X = 1:10, Cell.lines = structure(c(2L, 5L, 8L, 
>> 9L, 3L, 6L, 10L, 1L, 4L, 7L), .Label = c("T(70%)a-N(0%)c", "T(70%)a-N(0%)f", 
>> "T(70%)a-N(0%)i", "T(70%)c-N(0%)c", "T(70%)c-N(0%)f", "T(70%)c-N(0%)i", 
>> "T(80%)a-N(0%)c", "T(80%)a-N(0%)f", "T(90%)-N(0%)f", "T(90%)-N(0%)i"
>> ), class = "factor"), estimate = c(9859.74333, -5553.64802, 6227.17947, 
>> 8063.6472, 6548.86032, -8864.53103, 4752.7642, 9057.72021, -6355.67115, 
>> 5425.15635), lower = c(5560.57875, -9852.8126, 1928.01489, 3764.48262, 
>> 2249.69575, -13163.69561, 453.59962, 4758.55563, -10654.83573, 
>> 1125.99177), upper = c(14158.90791, -1254.48344, 10526.34405, 
>> 12362.81178, 10848.0249, -4565.36645, 9051.92877, 13356.88479, 
>> -2056.50657, 9724.32092), p.val.raw = c(1.15e-08, 5.78e-05, 1.36e-05, 
>> 3.21e-07, 6.91e-06, 6.97e-08, 0.000331, 4.87e-08, 1.04e-05, 7.63e-05
>> ), p.val.bon = c(2.66e-06, 0.0133, 0.00315, 7.41e-05, 0.0016, 
>> 1.61e-05, 0.0764, 1.13e-05, 0.0024, 0.0176), p.val.adj = c(2.65e-13, 
>> 0.000592, 2.82e-05, 9.72e-08, 6.56e-05, 8.76e-09, 0.0117, 6.22e-09, 
>> 6.44e-06, 0.000334)), .Names = c("X", "Cell.lines", "estimate", 
>> "lower", "upper", "p.val.raw", "p.val.bon", "p.val.adj"), class = "data.frame", row.names = c("T(70%)a-N(0%)f", 
>> "T(70%)c-N(0%)f", "T(80%)a-N(0%)f", "T(90%)-N(0%)f", "T(70%)a-N(0%)i", 
>> "T(70%)c-N(0%)i", "T(90%)-N(0%)i", "T(70%)a-N(0%)c", "T(70%)c-N(0%)c", 
>> "T(80%)a-N(0%)c"))
>>
>> rownames(sig.data)<-sig.data[,2]
>> my.hmtest <- structure(list(
>>   estimate = t(t(structure(sig.data[,"estimate"], .Names = rownames(sig.data)))),
>>   conf.int = sig.data[,4:5],
>>   ctype = "ABCC4-2007"),
>>   class = "hmtest")
>> par(mex=0.5) #This helps to accomodate the margins when text is getting cut off
>> plot(my.hmtest, cex.axis=0.7)
> 
> 
> There is not method plot.hmtest defined anywhere. Hence plot.default is 
> used and that one does not know hoe to handle an object like the one you 
> just defined.
> 
> Uwe Ligges
> 
> Here is a little portion of the code that  I used to generate the data. 
> 
> amod<-aov(Expression~isoforms.name, data=z)
>   mult.comp<-glht(amod,linfct=mcp(isoforms.name="Tukey"))
>    conf.int<-confint(mult.comp,level=0.99)
>    p.value<-summary(mult.comp)$test$pvalues
>    out.data.mat<-data.frame(conf.int$confint[,1:3],p.value)
>    filename.csv<-paste(filename[i], "csv",sep=".")
>    filename.csv<-paste("csv",filename.csv,sep="/")
>    write.table(out.data.mat, file=filename.csv, sep=",", qmethod="double", col.name=NA)
> 
> It is the csv file that I am trying to read and plot. Thanks for your help.


Ahhhh, again, the orgiginal code really helps to help:
A csv file does only contain the data values, all other structure of the 
object is lost. You can either directly ask

plot(mult.comp)

after your second line, or in order to plot later on, use save() to save 
the objects as an Rdata file and use load() to load it later on (e.g. 
for plotting purposes.

Best,
Uwe Ligges



Certainly I can plot mult.comp, but I only want to plot the significant ones so I parse the csv file to pick those that don't intersect the 0 line. I have saved the objects too. But there should be a way to plot it from the data saved in the csv file. It should have everything. I used to be able to do it with code that is giving me error. Some updates were made to the methods in R I guess 'plot' and I cannot get it to work anymore. Thanks for taking time to respond. I really appreciate it. 




> Cheers../Murli
>  
> 
>>  
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list