Hi Edward,
On Sep 11, 2009, at 1:47 PM, Edward Chen wrote:
> HI all,
> raw_urine >
read.table("Z:\\bruce.9.3.09.sample.stability.analysis\\urine\\mz.spot.sam.dat.new
> ",
> header = TRUE )
> pvalue >
read.table("Z:\\bruce.9.3.09.sample.stability.analysis\\urine\\all.urine.features.t.test.result
> ",
> header = TRUE )
> library(compositions)
> p = function(a,b){
> y = pvalue[,a]
> if(y<0.01){
> index = which(y, arr.ind=TRUE)
> day1 = raw_urine[index,3:7]
> day2 = raw_urine[index,b]
> graph = {matplot(raw_urine[index,1],day1,lwd = 3)
> matpoints(raw_urine[index,1],day2,lwd = 3, col="red")}
> print(graph)
> }}
>
> the above is my sample code in which i'm trying to output some
> graphs. but
> however, I can get return() to return value I want and all.
I don't see a return() call.
> But I just don't
> know if there's anything special I need to use to output graphs.
> I get this error msg: " Warning message:
> In if (y < 0.01) { :
> the condition has length > 1 and only the first element will be
used"
That's not an error, but a warning -- your code runs, but might be
doing something you don't expect it to be doing, since you're doing
something a bit non-intuitive:
R> a <- c(TRUE, FALSE, TRUE, TRUE)
R> if (a) cat("Hi\n") else cat("Bye\n")
Hi
Warning message:
In if (a) cat("Hi\n") else cat("Bye\n") :
the condition has length > 1 and only the first element will be used
You see how length(a) > 1 -- what should ``if (a)`` evaluate to? R is
telling you that it's just evaluating a[1].
So, maybe your data isn't what you expect it to be?
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact