[R] I need your help
Hi, Dear R users I have problem with the following code. The matrix result must be a matrix (3x3). But I have obtained a matrix(3x1) and I don't know why. So, I need your help Best regards # taille - function (delta, t, prob = 0.2) { niv.conf - c(0.90, 0.95, 0.99) if(niv.conf - 0.90) { t - 1.645 } else { if(niv.conf - 0.95) { t - 1.96 } t - 2.575 } n - length(delta) m - length(t) result - matrix(nrow = n, ncol = m); for (i in 1:n) { for(j in 1:m) { result[i,j]- prob*(1-prob)*((t[i])^2)/(delta[j])^2 ; } } rownames(result) - delta colnames(result) - niv.conf round(result,2) } taille (delta - c( 0.01, 0.02, 0.03), niv.conf - c(0.90, 0.95, 0.99)) Lassana KOITA Etudes de Sécurité et d'Exploitation aéroportuaires / Aerodrome Safety Statistical analysis Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical Department Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation Authority Tel: 01 49 56 80 60 Fax: 01 49 56 82 14 E-mail: [EMAIL PROTECTED] http://www.stac.aviation-civile.gouv.fr/ __ 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] I need your help
Hello, I made some adjustments to your code. 1) You used 't' twice in your code. When you assign t - 1.645, the length m of 't' becomes 1 (that's why your matrix was 3 x 1) 2) I assumed that the 'critical value' t is the quantile of a Normal (0,1). By using 't - qnorm(0.5*level + 0.5)' allows you to consider any value between 0 and 1 for level. Otherwise, you must write a 'neverending' list of 'if else'. If I assumed wrong, put back in the code the 'if else' statement. 3) The 'kronecker' function avoids the loops for 'i' and 'j' I hope this is what you want. Marco Geraci ## taille - function (delta, level, prob = 0.2) { t - qnorm(0.5*level + 0.5) n - length(delta) m - length(level) result - prob*(1-prob)*matrix(kronecker(t^2,delta^2,FUN=/), n, m, byrow=T) rownames(result) - delta colnames(result) - level round(result,2) } taille (delta = c(0.01, 0.02, 0.03), level = c(0.90, 0.95, 0.99)) # --- KOITA Lassana - STAC/ACE [EMAIL PROTECTED] wrote: Hi, Dear R users I have problem with the following code. The matrix result must be a matrix (3x3). But I have obtained a matrix(3x1) and I don't know why. So, I need your help Best regards # taille - function (delta, t, prob = 0.2) { niv.conf - c(0.90, 0.95, 0.99) if(niv.conf - 0.90) { t - 1.645 } else { if(niv.conf - 0.95) { t - 1.96 } t - 2.575 } n - length(delta) m - length(t) result - matrix(nrow = n, ncol = m); for (i in 1:n) { for(j in 1:m) { result[i,j]- prob*(1-prob)*((t[i])^2)/(delta[j])^2 ; } } rownames(result) - delta colnames(result) - niv.conf round(result,2) } taille (delta - c( 0.01, 0.02, 0.03), niv.conf - c(0.90, 0.95, 0.99)) Lassana KOITA Etudes de Sécurité et d'Exploitation aéroportuaires / Aerodrome Safety Statistical analysis Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical Department Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation Authority Tel: 01 49 56 80 60 Fax: 01 49 56 82 14 E-mail: [EMAIL PROTECTED] http://www.stac.aviation-civile.gouv.fr/ __ 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 __ 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
[R] I need your help....
Hello, I have a problem, I can't install the package 'mgu74av2cdf'. I downloaded the zip file, yet when asked the R console to install it from a zip file, I got the answer: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: error -1 in extracting from zip file 2: cannot open file `mgu74av2cdf/DESCRIPTION' What can I do? please help me Thank you in advance, Yair Snir __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] I need your help....
Yair Snir wrote: Hello, I have a problem, I can't install the package 'mgu74av2cdf'. I downloaded the zip file, yet when asked the R console to install it from a zip file, I got the answer: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: error -1 in extracting from zip file 2: cannot open file `mgu74av2cdf/DESCRIPTION' What can I do? please help me So it is probably not a valid binary package. Where is the package from (it's not a CRAN package)? Uwe Ligges Thank you in advance, Yair Snir __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] I need your help....
Uwe Ligges [EMAIL PROTECTED] writes: Yair Snir wrote: Hello, I have a problem, I can't install the package 'mgu74av2cdf'. I downloaded the zip file, yet when asked the R console to install it from a zip file, I got the answer: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: error -1 in extracting from zip file 2: cannot open file `mgu74av2cdf/DESCRIPTION' What can I do? please help me So it is probably not a valid binary package. Where is the package from (it's not a CRAN package)? It's an Affymetrix thingie, so the BioC list would be the more obvious place to ask. Notice that there are R data packages, e.g. http://biowww.dfci.harvard.edu/~bioconductor/data/cdfenvs/Win32/mgu74av2cdf_0.1.zip and (if I understand correctly) S-PLUS data libraries like http://www.insightful.com/support/ArrayAnalyzer/DataLibs/CDFLibs/mgu74cv2cdf.zip and I suspect they are not interchangeable even though both come in .zip files. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] I need your help....
This is a question for the Bioconductor listserv, not R-help. In addition, all current versions of affy will automagically download and install any cdfenvs that you may need, so there is no need to do this manually. If anything, you may need to update your version of affy. Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 Peter Dalgaard BSA [EMAIL PROTECTED] 10/07/03 06:33AM Uwe Ligges [EMAIL PROTECTED] writes: Yair Snir wrote: Hello, I have a problem, I can't install the package 'mgu74av2cdf'. I downloaded the zip file, yet when asked the R console to install it from a zip file, I got the answer: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: error -1 in extracting from zip file 2: cannot open file `mgu74av2cdf/DESCRIPTION' What can I do? please help me So it is probably not a valid binary package. Where is the package from (it's not a CRAN package)? It's an Affymetrix thingie, so the BioC list would be the more obvious place to ask. Notice that there are R data packages, e.g. http://biowww.dfci.harvard.edu/~bioconductor/data/cdfenvs/Win32/mgu74av2cdf_0.1.zip and (if I understand correctly) S-PLUS data libraries like http://www.insightful.com/support/ArrayAnalyzer/DataLibs/CDFLibs/mgu74cv2cdf.zip and I suspect they are not interchangeable even though both come in .zip files. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help