[R] Asymmetric colors for heatmap

2005-07-27 Thread Christian . Stratowa
 Dear expeRts,
 
 Currently, my colors are as follows:
 mycol -
 c(blue1,blue2,blue3,blue4,black,yellow4,yellow3,yellow2,y
 ellow1)
 heatmap(snp, Rowv=NA, Colv=NA, col=mycol)
 
 However, I would like to have the following colors:
 bright blue - dark blue: for intensity range from 0 to 2 in  steps of 0.5
 (i.e. 4 grades of blue)
 black:  for intensity 2
 dark yellow - bright yellow: for intensity range from 2 to 8 in steps of
 0.5 (i.e. 8 grades of yellow)
 
 You may realize that I want to display copy number data from SNP-chips as
 heatmap. 
 Since copynumber = 2, is the default value, I want to display it in black,
 LOH in increasing blue, and amplifications in increasing yellow.
 Even though there may be higher amplification rates, a value of CN=8
 should already display the brightest yellow.
 
 In Spotfire it is easy to achieve this, especially that CN=2 is always
 displayed as black, however, I do not know how to do it in R.
 Can you tell me how I have to create the colors to achieve this?
 
 (P.S.: Of course, I could do: snp[snp8] - 8, but this will not solve my
 problem with asymmetric colors)
 
 Thank you in advance
 Christian Stratowa
 
 
 
 
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Asymmetric colors for heatmap

2005-07-27 Thread Christian . Stratowa
Dear Sean
 
Thank you, however the heatmap() function from the stats package does not
have this option.
Browsing around I see that you  mean heatmap.2() from package gplots, which
we have not
installed yet.
 
Is there also another possibility besides heatmap.2() since I would also
need this option for
e.g. function image().
 
Best regards
Christian
 
-Original Message-
From: Sean Davis [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 27, 2005 13:16
To: [EMAIL PROTECTED];
r-help@stat.math.ethz.ch
Subject: Re: [R] Asymmetric colors for heatmap



See the breaks argument to heatmap.
 
Sean

- Original Message - 
From: [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  
To: r-help@stat.math.ethz.ch mailto:r-help@stat.math.ethz.ch  
Sent: Wednesday, July 27, 2005 3:54 AM
Subject: [R] Asymmetric colors for heatmap


 Dear expeRts, 
 
 Currently, my colors are as follows: 
 mycol - 
 c(blue1,blue2,blue3,blue4,black,yellow4,yellow3,yellow2,y

 ellow1) 
 heatmap(snp, Rowv=NA, Colv=NA, col=mycol) 
 
 However, I would like to have the following colors: 
 bright blue - dark blue: for intensity range from 0 to 2 in  steps of 0.5

 (i.e. 4 grades of blue) 
 black:  for intensity 2 
 dark yellow - bright yellow: for intensity range from 2 to 8 in steps of 
 0.5 (i.e. 8 grades of yellow) 
 
 You may realize that I want to display copy number data from SNP-chips as 
 heatmap. 
 Since copynumber = 2, is the default value, I want to display it in black,

 LOH in increasing blue, and amplifications in increasing yellow. 
 Even though there may be higher amplification rates, a value of CN=8 
 should already display the brightest yellow. 
 
 In Spotfire it is easy to achieve this, especially that CN=2 is always 
 displayed as black, however, I do not know how to do it in R. 
 Can you tell me how I have to create the colors to achieve this? 
 
 (P.S.: Of course, I could do: snp[snp8] - 8, but this will not solve my 
 problem with asymmetric colors) 
 
 Thank you in advance 
 Christian Stratowa 
 
 
 
 
 
 

__ 
R-help@stat.math.ethz.ch mailing list 
https://stat.ethz.ch/mailman/listinfo/r-help
https://stat.ethz.ch/mailman/listinfo/r-help  
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
http://www.R-project.org/posting-guide.html  


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Asymmetric colors for heatmap

2005-07-27 Thread Christian . Stratowa
Sorry, my mistake, I did not realize that image() has breaks and that
heatmap() inherits from image().
However, I have the following problem, maybe I am doing something wrong.

I have defined:
   mycol -
c(blue1,blue2,blue3,blue4,black,yellow4,yellow3,yellow2,yel
low1)
   breaks-c(0,0.5,1,1.5,2,2.5,3,4,5,6)

When I call image() then the colors change slightly:
   image(t(tmp),col=mycol,axes=F)
   image(t(tmp),col=mycol,axes=F,breaks=breaks)

However, when I call heatmap():
   heatmap(tmp,Rowv=NA,Colv=NA,col=mycol)
   heatmap(tmp,Rowv=NA,Colv=NA,col=mycol,breaks=breaks)
then breaks results in half of the heatmap drawn in white!

Do you know what may be my mistake?

Best regards
Christian

-Original Message-
From: Stratowa,Dr.,Christian FEX BIG-AT-V
Sent: Wednesday, July 27, 2005 14:07
To: 'Sean Davis'; r-help@stat.math.ethz.ch
Subject: RE: [R] Asymmetric colors for heatmap


Dear Sean

Thank you, however the heatmap() function from the stats package does not
have this option.
Browsing around I see that you  mean heatmap.2() from package gplots, which
we have not
installed yet.

Is there also another possibility besides heatmap.2() since I would also
need this option for
e.g. function image().

Best regards
Christian

-Original Message-
From: Sean Davis [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 27, 2005 13:16
To: [EMAIL PROTECTED];
r-help@stat.math.ethz.ch
Subject: Re: [R] Asymmetric colors for heatmap


See the breaks argument to heatmap.

Sean

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] RE: Comparison of correlation coefficients - Details

2004-07-22 Thread Christian . Stratowa
Dear Ioannis

Thank you very much for pointing me to meta-analysis. Although it
may not solve my problem with the normalization, it gives me some
other options to display the different correlation coefficients.

One possibility is the use of Funnel plots, which are even available
in library(rmeta). Another possibility is the use of forest-plots, 
as implemented in rmeta as metaplot. Sorrowly, rmeta does not include 
the Rosenthal-Rubin method or the Hunter-Schmidt method, as described
in Meta-Analysis of Correlations, see:
   http://www.sussex.ac.uk/Users/andyf/teaching/pg/meta.pdf
Probably, the best solution for me may be to modify metaplot for
the Hunter-Schmidt method.
BTW, the manual to the program Meta-Analysis 5.3, is also very helpful,
see: http://userpage.fu-berlin.de/~health/meta_e.htm

Further suggestions in this direction are greatly appreciated.

Best regards
Christian Stratowa

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 21, 2004 18:07
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [R] RE: Comparison of correlation coefficients - Details


That sounds very close to a meta-analytic comparison of two statistics. 
As a matter of fact, the Rosenthal  Rubin approach transforms all primary
statistics into Pearson r and then to Fisher's z and then follows with
comparisons.  More, comparisons can take into account sample sizes, or the
value of some other predictor variable.

I believe there is a Rosenthal book on meta-analysis published by Sage
publications, as well as a Brian Mullen book published by Lawrence Erlbaum.
Brian Mullen's book comes (or used to come) with a meta.exe program to
perform meta-analyses.

Hope this helps,

Ioannis

 Dear all

 I apologize for cross-posting, but first it is accepted custom to 
 thank the repliers and give a summary, and second I have still the 
 feeling that this problem might be a general statistical problem and 
 not necessarily related to microarrays only, but I might be wrong.

 First, I want to thank Robert Gentleman, Mark Kimpel and Mark Reiners 
 for their kind replies. Robert Gentleman kindly pointed me to the 
 Bioconductor package MeasurementError.cor as alternative to 
 cor.test. Mark Kimpel suggested that 2-way factorial Anova or the 
 Bioconductor package limma, respectively, may be helpful. Mark 
 Reiners suggested to use the p-value of cor.test to test the 
 significance.

 Maybe, I miss the point, but being not a statistician I am still 
 unsure if it is possible to compare correlation coefficients from 
 different sample sets. Both, the p-values from cor.test and from 
 compcorr, could be used as measure of the significance. However, is 
 it possible to normalize correlation coefficients from different 
 sample sets? Could an expression such as corr * (1 - pval) be used 
 for normalization? Maybe, it is not possible to normalize correlation 
 coefficients? Would a barplot comparing the correlation coefficients 
 between two genes for different tissues be meaningful? (Alternatively, 
 I have tried to use (1-pval) to calculate the gray-level of the bars.)

 Any further suggestions would be appreciated very much.

 Best regards
 Christian Stratowa

 -Original Message-
 From: Stratowa,Dr.,Christian FEX BIG-AT-V
 Sent: Monday, July 19, 2004 15:00
 To: '[EMAIL PROTECTED]'
 Subject: Comparison of correlation coefficients - Details


 Dear all

 Maybe, my last mail did not explain my problem correctly: Since we are 
 interested, which genes have similar expression profiles in a certain 
 tissue or in different tissues, we have calculated the correlation 
 coefficients between all 46,000 x 46,000 genes of the HG_U133A/B 
 chipset for about 70 tissues, where the number of samples per tissue 
 ranges from 10 to more than 200.

 While writing an R-function to display the correlation coefficients 
 between gene A and B in the different tissues as bar-graph, I realized 
 that it may not be correct to compare the different correlation 
 coefficients directly, since the number of samples per tissue varyies 
 between 10 and 200.

 Thus, the question is: Is there a way to compare different correlation 
 coefficients and/or apply some kind of normalization?

 Assuming that this might be a well known statistical problem I was 
 browsing statistics books and the web for more information, but could 
 only find the function compcorr which gives a p-value how well you 
 can trust the comparison of two correlation coefficients from 
 different samples.

 Even though this might currently not be a direct Bioconductor 
 question, it is certainly a microarray analysis related question. Any 
 suggestions how to solve this problem would be greatly appreciated.

 Best regards
 Christian Stratowa


 -Original Message-
 From: Stratowa,Dr.,Christian FEX BIG-AT-V
 Sent: Tuesday, July 13, 2004 14:40
 To: '[EMAIL PROTECTED]'
 Subject: Comparison of correlation coefficients


 Dear

[R] RE: Comparison of correlation coefficients - Details

2004-07-21 Thread Christian . Stratowa
Dear all

I apologize for cross-posting, but first it is accepted custom to 
thank the repliers and give a summary, and second I have still 
the feeling that this problem might be a general statistical problem 
and not necessarily related to microarrays only, but I might be wrong.

First, I want to thank Robert Gentleman, Mark Kimpel and Mark Reiners
for their kind replies. Robert Gentleman kindly pointed me to the
Bioconductor package MeasurementError.cor as alternative to cor.test.
Mark Kimpel suggested that 2-way factorial Anova or the Bioconductor
package limma, respectively, may be helpful. Mark Reiners suggested
to use the p-value of cor.test to test the significance.

Maybe, I miss the point, but being not a statistician I am still unsure
if it is possible to compare correlation coefficients from different 
sample sets. Both, the p-values from cor.test and from compcorr,
could be used as measure of the significance. 
However, is it possible to normalize correlation coefficients from
different sample sets? Could an expression such as corr * (1 - pval) 
be used for normalization? Maybe, it is not possible to normalize
correlation coefficients?
Would a barplot comparing the correlation coefficients between two
genes for different tissues be meaningful? (Alternatively, I have 
tried to use (1-pval) to calculate the gray-level of the bars.)

Any further suggestions would be appreciated very much.

Best regards
Christian Stratowa

-Original Message-
From: Stratowa,Dr.,Christian FEX BIG-AT-V 
Sent: Monday, July 19, 2004 15:00
To: '[EMAIL PROTECTED]'
Subject: Comparison of correlation coefficients - Details


Dear all

Maybe, my last mail did not explain my problem correctly:
Since we are interested, which genes have similar expression profiles in a
certain tissue or in different tissues, we have calculated the 
correlation coefficients between all 46,000 x 46,000 genes of the 
HG_U133A/B chipset for about 70 tissues, where the number of samples 
per tissue ranges from 10 to more than 200.

While writing an R-function to display the correlation coefficients between
gene A and B in the different tissues as bar-graph, I realized that it may
not be correct to compare the different correlation coefficients directly,
since the number of samples per tissue varyies between 10 and 200.

Thus, the question is: Is there a way to compare different correlation
coefficients and/or apply some kind of normalization?

Assuming that this might be a well known statistical problem I was browsing
statistics books and the web for more information, but could only find the
function compcorr which gives a p-value how well you can trust the 
comparison of two correlation coefficients from different samples.

Even though this might currently not be a direct Bioconductor question, it
is certainly a microarray analysis related question. Any suggestions how to
solve this problem would be greatly appreciated.

Best regards
Christian Stratowa


-Original Message-
From: Stratowa,Dr.,Christian FEX BIG-AT-V 
Sent: Tuesday, July 13, 2004 14:40
To: '[EMAIL PROTECTED]'
Subject: Comparison of correlation coefficients


Dear Bioconductor expeRts

Is it possible to compare correlation coefficients or to normalize 
different correlation coefficients?

Concretely, we have the following situation:
We have gene expression profiles for different tissues, where the 
number of samples per tissue are different, ranging from 10 to 250. 
We are able to determine the correlation between two genes A and B 
for each tissue separately, using cor.test. However, the question 
arises if the correlation coefficients between different tissues can 
be compared or if they must somehow be normalized, since the 
number of samples per tissue varyies. 

Searching the web I found the function compcorr, see:
http://www.fon.hum.uva.nl/Service/Statistics/Two_Correlations.html
http://ftp.sas.com/techsup/download/stat/compcorr.html
and implemented it in R:

compcorr - function(n1, r1, n2, r2){
# compare two correlation coefficients
# return difference and p-value as list(diff, pval)

#   Fisher Z-transform
zf1 - 0.5*log((1 + r1)/(1 - r1))
zf2 - 0.5*log((1 + r2)/(1 - r2))

#   difference
dz - (zf1 - zf2)/sqrt(1/(n1 - 3) + (1/(n2 - 3)))

#   p-value
pv - 2*(1 - pnorm(abs(dz)))

return(list(diff=dz, pval=pv))
}

Would it make sense to use the resultant p-value to normalize the 
correlation coefficients, using: corr - corr * compcorr()$pval

Is there a better way or an alternative to normalize the correlation 
coefficients obtained for different tissues?

Thank you in advance for your help.
Since in the company I am not subscribed to bioconductor-help, could you 
please reply to me (in addition to bioconductor-help)

P.S.: I have posted this first at r-help and it was suggested to me to 
post it here, too.

Best regards
Christian Stratowa

==
Christian Stratowa, PhD

[R] Comparison of correlation coefficients

2004-07-13 Thread Christian . Stratowa
Dear expeRts

Is it possible to compare correlation coefficients or to normalize 
different correlation coefficients?

Concretely, we have the following situation:
We have gene expression profiles for different tissues, where the 
number of samples per tissue are different, ranging from 10 to 250.
We are able to determine the correlation between two genes A and B
for each tissue separately, using cor.test. However, the question
arises if the correlation coefficients between different tissues
can be compared or if they must somehow be normalized, since the
number of samples per tissue varyies. 

Searching the web I found the function compcorr, see:
http://www.fon.hum.uva.nl/Service/Statistics/Two_Correlations.html
http://ftp.sas.com/techsup/download/stat/compcorr.html
and implemented it in R:

compcorr - function(n1, r1, n2, r2){
# compare two correlation coefficients
# return difference and p-value as list(diff, pval)

#   Fisher Z-transform
zf1 - 0.5*log((1 + r1)/(1 - r1))
zf2 - 0.5*log((1 + r2)/(1 - r2))

#   difference
dz - (zf1 - zf2)/sqrt(1/(n1 - 3) + (1/(n2 - 3)))

#   p-value
pv - 2*(1 - pnorm(abs(dz)))

return(list(diff=dz, pval=pv))
}

Would it make sense to use the resultant p-value to normalize
the correlation coefficients, using: corr - corr * compcorr()$pval

Is there a better way or an alternative to normalize the
correlation coefficients obtained for different tissues?

Thank you in advance for your help.
Since in the company I am not subscribed to r-help, could you 
please reply to me (in addition to r-help)

Best regards
Christian Stratowa

==
Christian Stratowa, PhD
Boehringer Ingelheim Austria
Dept NCE Lead Discovery - Bioinformatics
Dr. Boehringergasse 5-11
A-1121 Vienna, Austria
Tel.: ++43-1-80105-2470
Fax: ++43-1-80105-2782
email: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] FW: [Fwd: Re: [S] Exact p-values]

2003-02-14 Thread Christian . Stratowa
Dear Spencer

Thank you for this extensive explanation of the problem.
I was just curious.

Best regards
Christian

==
Christian Stratowa, PhD
Boehringer Ingelheim Austria
Dept NCE Lead Discovery - Bioinformatics
Dr. Boehringergasse 5-11
A-1121 Vienna, Austria
Tel.: ++43-1-80105-2470
Fax: ++43-1-80105-2683
email: [EMAIL PROTECTED]

 -Original Message-
 From: Spencer Graves [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, February 14, 2003 1:29 PM
 To:   Stratowa,Dr,Christian   FEX BIG-AT-V
 Cc:   [EMAIL PROTECTED]; David Smith
 Subject:  Re: [R] FW: [Fwd: Re: [S] Exact p-values]
 
 To understand the correct answer, you need to understand the following:
 
   pbinom(1, 2, .5)
 [1] 0.75
 
 This is the binomial cumulative distribution function.
 *** pbinom(0, 2, .5) = 0.25
 *** pbinom(1, 2, .5) = 0.75 = 0.25 + 0.5
 *** pbinom(2, 2, .5) = 1
 
 However, pbinom(1e15, 2e15, .5) is a computational challenge.  Standard 
 numerical algorithms often fail in situations like this.  The code 
 should test for such cases and use more numerically stable 
 approximations in place of the exact algorithms.
 
 The standard deviation for a binomial is sqrt(p*(1-p)/n) = 
 0.5/sqrt(2e15), which is roughly 1e-8 in your case.
 
 
 I get the following from both S-Plus and R:
 
   pbinom(1e5+c(-1, 0, 1), 2e5, .5)
 [1] 0.4991079 0.5008921 0.5026762
 
 For the problem you cite, the correct answer should be 0.5 to about 8 
 significant digits.  Instead, I get 1 from R (as you did) and the 
 following from S-Plus:
 
   pbinom(1e15,2e15,0.5)
 [1] 0.7411209
 
 Both give wrong answers without warning, though in this case, S-Plus is 
 closer.
 
 Answer the question?
 Spencer Graves
 #
 
 [EMAIL PROTECTED] wrote:
  Dear all
  
  Just for fun, I have just downloaded the paper mentioned below and
 checked
  it with R-1.6.1.
  Everything is ok with exception of Table 2b, where I get always 1
 instead of
  0.5:
  
 pbinom(1e15,2e15,0.5)
  
  [1] 1
  
  Which value should be correct?
  
  Best regards
  Christian Stratowa
  
  ==
  Christian Stratowa, PhD
  Boehringer Ingelheim Austria
  Dept NCE Lead Discovery - Bioinformatics
  Dr. Boehringergasse 5-11
  A-1121 Vienna, Austria
  Tel.: ++43-1-80105-2470
  Fax: ++43-1-80105-2683
  email: [EMAIL PROTECTED]
  
  
  
  Original Message 
 Subject: Re: [S] Exact p-values
 Date: Thu, 13 Feb 2003 18:31:38 +0100
 From: Rau, Roland [EMAIL PROTECTED]
 To: 'Spencer Graves' [EMAIL PROTECTED],  Jose María Fedriani
 Laffitte [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 
 Dear all,
 
 in relation to your question, the following working paper of Leo
 Knuesel,
 University of Munich, might be of interest:
 On the Accuracy of Statistical Distributions in S-Plus for Windows
 (1999)
 You can download the paper from (pdf-Format, 45k):
 http://www.stat.uni-muenchen.de/~knuesel/elv/accuracy.html
 
 Best,
 Roland
 
   -Original Message-
   From:Spencer Graves [SMTP:[EMAIL PROTECTED]]
   Sent:Thursday, February 13, 2003 6:12 PM
   To:  Jose María Fedriani Laffitte
   Cc:  [EMAIL PROTECTED]
   Subject: Re: [S] Exact p-values
  
  
   Try ( 1-pchisq(29.8, df=1)):  With S-Plus 6.1, I got  4.78992e-008.
  
By the way, the distribtion functions in R have more
 arguments.
For example,  pchisq(29.8, df=1, lower.tail=F) produces the same
   answer, and pchisq(29.8, df=1, lower.tail=F, log=T) produces its
 natural
   logarithm.  Also, pchisq, dchisq, qchisq, and rchisq in R all have an
   ncp noncentrality parameter argument;  only pchisq has such in
 S-Plus
   6.1.  Similarly, none of the Student's t functions in S-Plus have a
   non-centralitity parameter;  in R, pt has an argument ncp, and from
 this
   one can easily program ncp for dt, qt and rt.  Also, the distribution
   functions in the current release of S-Plus are known to have
 problems.
For example, pt(-1, Inf) = 0.5 in S-Plus 6.1, but 0.159 in R;
 clearly,
   S-Plus gives a wrong answer without warning.
  
   Best Wishes,
   Spencer Graves
  
   Jose María Fedriani Laffitte wrote:
  
   Dear all,
   
   I want to get the exact p-values, on 1 degree of freedom, for an
   array
   of chi-square values.  When my chi-square values are equal or lower
 than
   29.7, I get the exact associated p-values.  Thus, for instance:
   
   
   
   pchisq(29.7, df=1)
   
   
   [1] 0.999
   
   However, when my chi-square values are greater or equal to 29.8 what
 I
   get
   is:
   
   
   
   pchisq(29.8, df=1)
   
   
   [1] 1
   
   
   Could anyone tell me how to fix this trivial issue?  Very
 grateful,
   Jose
   M. Fedriani
   
   
   Jose Mª Fedriani Laffitte
   Estacion Biologica de Donana (CSIC)
   Avda. Mª Luisa s/n
   41013-Sevilla
   Spain
   Tel. +34-954232340
   Fax +34-954621125
   http://ebd.csic.es

[R] reading non-existent files

2003-01-28 Thread Christian . Stratowa
Dear R-experts

I would like to read all files from a directory, the files have names
myname0001.txt etc. I paste the directory plus file names and
use read.delim().
My problem is that some file names are missing, so I get an error
and my program stops.
Is there a way to check for a null pointer analogous to C, so that
I can simply skip non-existent filenames?

Please do Reply to all since in the company I am not subscribed
to the R-help list.

Thank you in advance
Best regards
Christian Stratowa

==
Christian Stratowa, PhD
Boehringer Ingelheim Austria
Dept NCE Lead Discovery - Bioinformatics
Dr. Boehringergasse 5-11
A-1121 Vienna, Austria
Tel.: ++43-1-80105-2470
Fax: ++43-1-80105-2683
email: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



RE: [R] reading non-existent files

2003-01-28 Thread Christian . Stratowa
Great, thank you for the fast reply

Regards
Christian Stratowa

==
Christian Stratowa, PhD
Boehringer Ingelheim Austria
Dept NCE Lead Discovery - Bioinformatics
Dr. Boehringergasse 5-11
A-1121 Vienna, Austria
Tel.: ++43-1-80105-2470
Fax: ++43-1-80105-2683
email: [EMAIL PROTECTED]

 -Original Message-
 From: Ben Bolker [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, January 28, 2003 4:15 PM
 To:   Stratowa,Dr,Christian   FEX BIG-AT-V
 Cc:   [EMAIL PROTECTED]
 Subject:  Re: [R] reading non-existent files
 
 
   ?file.exists
 
 On Tue, 28 Jan 2003 [EMAIL PROTECTED] wrote:
 
  Dear R-experts
  
  I would like to read all files from a directory, the files have names
  myname0001.txt etc. I paste the directory plus file names and
  use read.delim().
  My problem is that some file names are missing, so I get an error
  and my program stops.
  Is there a way to check for a null pointer analogous to C, so that
  I can simply skip non-existent filenames?
  
  Please do Reply to all since in the company I am not subscribed
  to the R-help list.
  
  Thank you in advance
  Best regards
  Christian Stratowa
  
  ==
  Christian Stratowa, PhD
  Boehringer Ingelheim Austria
  Dept NCE Lead Discovery - Bioinformatics
  Dr. Boehringergasse 5-11
  A-1121 Vienna, Austria
  Tel.: ++43-1-80105-2470
  Fax: ++43-1-80105-2683
  email: [EMAIL PROTECTED]
  
  __
  [EMAIL PROTECTED] mailing list
  http://www.stat.math.ethz.ch/mailman/listinfo/r-help
  
 
 -- 
 318 Carr Hall[EMAIL PROTECTED]
 Zoology Department, University of Floridahttp://www.zoo.ufl.edu/bolker
 Box 118525   (ph)  352-392-5697
 Gainesville, FL 32611-8525   (fax) 352-392-3704

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



RE: [R] reading non-existent files

2003-01-28 Thread Christian . Stratowa
Dear All

Thank you all for your fast help, the solutions that I have received are:
file.exists()
try()
allFiles-list.files(mydir)

Best regards
Christian Stratowa

==
Christian Stratowa, PhD
Boehringer Ingelheim Austria
Dept NCE Lead Discovery - Bioinformatics
Dr. Boehringergasse 5-11
A-1121 Vienna, Austria
Tel.: ++43-1-80105-2470
Fax: ++43-1-80105-2683
email: [EMAIL PROTECTED]

 -Original Message-
 From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, January 28, 2003 4:20 PM
 To:   Stratowa,Dr,Christian   FEX BIG-AT-V
 Cc:   [EMAIL PROTECTED]
 Subject:  Re: [R] reading non-existent files
 
 On Tue, 28 Jan 2003 [EMAIL PROTECTED] wrote:
 
  I would like to read all files from a directory, the files have names
  myname0001.txt etc. I paste the directory plus file names and
  use read.delim().
  My problem is that some file names are missing, so I get an error
  and my program stops.
 
 How can some of `all files from a directory' be missing?  Why not read 
 them via e.g. list.files()?
 
  Is there a way to check for a null pointer analogous to C, so that
  I can simply skip non-existent filenames?
 
 ?file.exists
 
 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595


__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help