Re: [R] assign values
Please do read the posting guide. The answer to your question can be found by help(-) or help(=). The '-' can be used anywhere, but the '=' is only allowed at the top level (that is, in the complete expression typed by the user) or as one of the subexpressions in a braced list of expressions. If you don't fully understand that, just use - always. On Sat, 12 Nov 2005, someone not signing his posting wrote: Any difference between - and = to assign the values? [[alternative HTML version deleted]] PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html and no HTML mail please, as we ask. -- 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 __ 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] voronoi
See package tripack. You can find this information with RSiteSearch(voronoi, restrict = functions) Best, Renaud 2005/11/13, Robert [EMAIL PROTECTED]: Is there any pure r code to do delaunay or voronoi diagrams? Thanks! - [[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 -- Renaud LANCELOT Département Elevage et Médecine Vétérinaire (EMVT) du CIRAD Directeur adjoint chargé des affaires scientifiques CIRAD, Animal Production and Veterinary Medicine Department Deputy director for scientific affairs Campus international de Baillarguet TA 30 / B (Bât. B, Bur. 214) 34398 Montpellier Cedex 5 - France Tél +33 (0)4 67 59 37 17 Secr. +33 (0)4 67 59 39 04 Fax +33 (0)4 67 59 37 95 __ 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] computation on a table
On Sun, 13 Nov 2005, Peter Dalgaard wrote: jim holtman [EMAIL PROTECTED] writes: [...] index - match(colnames(table2), colnames(table1), nomatch=0) t(t(table1[,index]) / table2[index != 0, drop=FALSE]) [...] or even sweep(table1, 2, table2[colnames(table1)], /) Perfect. I was not aware of sweep. The R help pages I read to solve this problem did not refer to that. Thanks to Jim and Peter. Claus __ 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] voronoi
On 13 Nov 2005, at 10:17, Renaud Lancelot wrote: See package tripack. You can find this information with RSiteSearch(voronoi, restrict = functions) So the answer is no. The question was about pure r code (with this capitalization), and voronoi.mosaic() in 'tripack' uses .Fortran. cheers, jari oksanen 2005/11/13, Robert [EMAIL PROTECTED]: Is there any pure r code to do delaunay or voronoi diagrams? Thanks! - [[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 -- Renaud LANCELOT Département Elevage et Médecine Vétérinaire (EMVT) du CIRAD Directeur adjoint chargé des affaires scientifiques CIRAD, Animal Production and Veterinary Medicine Department Deputy director for scientific affairs Campus international de Baillarguet TA 30 / B (Bât. B, Bur. 214) 34398 Montpellier Cedex 5 - France Tél +33 (0)4 67 59 37 17 Secr. +33 (0)4 67 59 39 04 Fax +33 (0)4 67 59 37 95 __ 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 -- Jari Oksanen, Oulu, Finland __ 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] Legend
I use the following to plot two graphs over each other and then insert a legend, but the two items in the legend both come up the same colour x = seq(0,30,0.01) plot(ecdf(complete), do.point=FALSE, main = 'Cummlative Plot of Monday IATs for Data and\n Fitted PDF over Entire 15 Weeks') lines(x, pexp(x,0.415694806),col=red) legend(x=5,y=0.2 , legend=c(Data Set,Fitted PDF),col=c(black,red)) Many thanks Mark Miller __ 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] Legend
Mark Miller wrote: I use the following to plot two graphs over each other and then insert a legend, but the two items in the legend both come up the same colour x = seq(0,30,0.01) plot(ecdf(complete), do.point=FALSE, main = 'Cummlative Plot of Monday IATs for Data and\n Fitted PDF over Entire 15 Weeks') lines(x, pexp(x,0.415694806),col=red) legend(x=5,y=0.2 , legend=c(Data Set,Fitted PDF),col=c(black,red)) Many thanks Mark Miller Hi, Mark, You want to use text.col in legend instead of col: set.seed(1) z - rexp(30, 0.415694806) x - seq(0, 30, 0.1) plot(ecdf(z), do.point = FALSE) lines(x, pexp(x, 0.415694806), col=red) legend(x = 5, y = 0.2, legend = c(Data Set, Fitted PDF), text.col = c(black, red)) --sundar __ 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] Legend
And you want to have different colored lines but black texts, try legend(x = 5, y = 0.2, legend = c(Data Set, Fitted PDF), col = c(black, red), lty=1) The advantage of this is that you can use dotted (lty option) or lines with different weights (lwd option). Regards, Adai On Sun, 2005-11-13 at 06:46 -0600, Sundar Dorai-Raj wrote: Mark Miller wrote: I use the following to plot two graphs over each other and then insert a legend, but the two items in the legend both come up the same colour x = seq(0,30,0.01) plot(ecdf(complete), do.point=FALSE, main = 'Cummlative Plot of Monday IATs for Data and\n Fitted PDF over Entire 15 Weeks') lines(x, pexp(x,0.415694806),col=red) legend(x=5,y=0.2 , legend=c(Data Set,Fitted PDF),col=c(black,red)) Many thanks Mark Miller Hi, Mark, You want to use text.col in legend instead of col: set.seed(1) z - rexp(30, 0.415694806) x - seq(0, 30, 0.1) plot(ecdf(z), do.point = FALSE) lines(x, pexp(x, 0.415694806), col=red) legend(x = 5, y = 0.2, legend = c(Data Set, Fitted PDF), text.col = c(black, red)) --sundar __ 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] How to show numerical values on boxplots
Hi, dear all, I want to show numerical values with decimal points on the boxplots. Here is what I did: For example; x1-rnorm(100,2,2); x2-rexp(100); label-rep(1:2, rep(100,2)) median-round(c(median(x1), median(x2)),3) boxplot(c(x1, x2)~label, medpch=paste(median), medcex=1.2) It only shows the integers at the median position in the boxplots. How to make it show more decimal points pls? Thanks a lot. Lily NUS [[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] How to show numerical values on boxplots
Yue Li wrote: Hi, dear all, I want to show numerical values with decimal points on the boxplots. Here is what I did: For example; x1-rnorm(100,2,2); x2-rexp(100); label-rep(1:2, rep(100,2)) median-round(c(median(x1), median(x2)),3) boxplot(c(x1, x2)~label, medpch=paste(median), medcex=1.2) medpch issimilar as pch for a plotting character, but not a string. Hence I'd add the median values by a call to text() as in: bpo - boxplot(c(x1, x2) ~ label, medcex=1.2) text(1:2, bpo$stats[3,], median, pos=3) Uwe Ligges It only shows the integers at the median position in the boxplots. How to make it show more decimal points pls? Thanks a lot. Lily NUS [[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 __ 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] About: Error in FUN(X[[1]], ...) : symbol print-name too long
gsmatos1 wrote: Hi, I´m trying to use the Win2BUGS package from R and I have a similar problem that reurns with the message: Error in FUN(X[[1]], ...) : symbol print-name too long I took a first look. The above looks like a bug in package rbugs which does some really strange things by pasting huge strings. It is completely unrelated with R2WinBUGS. But, there is no stray ` character in the file ( Sugestions given by: Duncan Temple Lang duncan Date: Mon, 26 Sep 2005 07:31:08 -0700 ) The progam in R is: library(R2WinBUGS) library(rbugs) Please omit the line above. dat - list(x=c(49,48,50,44,54,56,48,48,51,51,50,53,51,50,51,54,50,53,50,49,51,47,53,50,49,55,53,48,54,46), y=c(50,49,57,52,47,52,58,45,55,54,51,54,56,53,52,47,51,54,50,47,46,44,54,55,52,57,52,48,48,51)) dat - format4Bugs(dat, digits = 0) Please omit the line above. parm - c(lbda) bugs(dat, inits=list(NULL), parm, d2.bug, n.chains = 1, n.iter = 5000, n.burnin = floor(n.iter/2), n.thin = max(1, floor(n.chains * (n.iter - n.burnin)/1000)), bin = (n.iter - n.burnin) / n.thin, debug = TRUE, DIC = TRUE, digits = 5, codaPkg = FALSE, bugs.directory = C:/WinBUGS14/, working.directory = NULL, clearWD = FALSE) The above should simply read: bugs(dat, NULL, parm, d2.bug, n.chains = 1, n.iter = 5000, debug = TRUE, bugs.directory = C:/WinBUGS14/) which reveals a bug in the function bugs(): the first lines do not special case inits=NULL and should read if (!missing(inits) !is.function(inits) !is.null(inits) (length(inits) != n.chains)) rather than if (!missing(inits) !is.function(inits) (length(inits) != n.chains)) Please change it simply by calling fix(bugs) for the meantime. I will submit a patched version of R2WinBUGS to CRAN within next week. Applying your model with fixed versions of your code and R2WinBUGS also shows that you get some errors in WinBUGS and you have to change your model file, but that's another issue... Uwe Ligges The objective of the program is to compare means of two independent samples that results in Beherens-Fisher posterior and in the model.file of WinBUGS d2.bug there is the following codes: model { for( i in 1 : 30 ) { x[i] ~ dnorm(mu1,sig1) } for( i in 1 : 30 ) { y[i] ~ dnorm(mu2,sig2) } mu1 ~ dnorm(50,1.0E-6) sig1 ~ dgamma(0.001,0.001) mu2 ~ dnorm(50,1.0E-6) sig2 ~ dgamma(0.001,0.001) lbda - mu1 - mu2 } I´m a new user of WinBUGS and if someone detect error in the model codes too, I´m grateful. Thanks for help! Gilberto Matos. model { for( i in 1 : 30 ) { x[i] ~ dnorm(mu1,sig1) } for( i in 1 : 30 ) { y[i] ~ dnorm(mu2,sig2) } mu1 ~ dnorm(50,1.0E-6) sig1 ~ dgamma(0.001,0.001) mu2 ~ dnorm(50,1.0E-6) sig2 ~ dgamma(0.001,0.001) lbda - mu1 - mu2 } __ 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
Re: [R] computation on a table
Claus Atzenbeck [EMAIL PROTECTED] writes: On Sun, 13 Nov 2005, Peter Dalgaard wrote: jim holtman [EMAIL PROTECTED] writes: [...] index - match(colnames(table2), colnames(table1), nomatch=0) t(t(table1[,index]) / table2[index != 0, drop=FALSE]) [...] or even sweep(table1, 2, table2[colnames(table1)], /) Perfect. I was not aware of sweep. The R help pages I read to solve this problem did not refer to that. So you didn't look at ?prop.table, I guess -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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] assign values
Prof Brian Ripley [EMAIL PROTECTED] writes: Please do read the posting guide. The answer to your question can be found by help(-) or help(=). The '-' can be used anywhere, but the '=' is only allowed at the top level (that is, in the complete expression typed by the user) or as one of the subexpressions in a braced list of expressions. If you don't fully understand that, just use - always. The text is not completely accurate though: if ((x=2)) 2 [1] 2 x [1] 2 if (x=2) 2 Error: syntax error in if(x= if(x-2) 2 [1] 2 if(x -2) 2 We do allow = inside parentheses too, it's only in function arguments (where it is ambiguous) and inside conditional clauses (where users might use it incorrectly to test for equality) that we disallow it. As the last example shows, we do leave people to fry in their own fat if they use - for comparisons with negative numbers, though (been there, done that...) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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] Julien Ruiz est absent.
Je serai absent(e) du 12/11/2005 au 16/11/2005. Je répondrai à votre message dès mon retour. I will be out of the office from 14-MAR-2005 until 18-MAR-2005 I will reply to your message on my return. Julien Ruiz L'acces immediat aux meilleurs tarifs Air France et au billet electronique sur http://www.airfrance.com For immediate access to the best Air France fares and to electronic tickets, visit our website http://www.airfrance.com Les donnees et renseignements contenus dans ce message sont personnels, confidentiels et secrets. Ce message est adresse a l'individu ou l'entite dont les coordonnees figurent ci-dessus. Si vous n'etes pas le bon destinataire, nous vous demandons de ne pas lire, copier, utiliser ou divulguer cette communication. Nous vous prions de notifier cette erreur a l'expediteur et d'effacer immediatement cette communication de votre systeme. The information contained in this message is privileged, confidential, and protected from disclosure. This message is intended for the individual or entity adressed herein. If you are not the intended recipient, please do not read, copy, use or disclose this communication to others; also please notify the sender by replying to this message, and then delete it from your system. __ 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] simulation of compound Poisson and Cox process
Hello. I have this problem. It is modeling high-frequency financial data. The gamma OU process X (t), BDLP compound Poisson with intensity h 0 and E(a) exponential (a) distribution of jump. Lévy density w of Z (1): w(x) = ahexp(-ax), x is more or equal than 0, f(R) infinity, g(z) = izh/(a-iz). OUCP rejection sampling x(t) = x(0)exp(-ct) + suma(0t(j)is less or equal to T)[z(j)exp(t(j)-ct)], cf. shot noise Cox process, 0 t1 .. tk is less or equal to T jump times of BDLP Z, z(j) jumps. Let B = max (0tT)[x(t)] = max (1jk)[[x(0) + suma(l goes from 1 to j)z(l)exp(t(l))]exp(-t(j))], simulate Poisson (BT) = m, then m uniform points on [0,T]. Each point s is let with probability x(s) / B, 0 s1 s2 ... sn T, n m. Could you please help me to simulate this process? I hope that it is possible to do it in R. Thanks in advance Barbora Kocurova __ 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] problem with grid animation
I'm trying to do animation with grid. Basically it's a vector field, like what 'quiver' in Matlab creates. I need to update it with grid.edit(). It seems grid erases the whole thing first, then redraws. Therefore the evident 'flash' between frames. Any way to avoid this flash? Thanks. __ 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] selection of missing data
Hi i'm a french medical student, i have some data that i import from excel. My colomn of the datafram are the localisations of metastasis. If there is a metatsasis there is the symbol _. i want to exclude the row without metastasis wich represent the NA data. so, i wrote this mela is the data fram mela1=ifelse(mela[,c(11:12,14:21,23,24)]==_,1,0) # selection of the colomn of metastasis localisation mela4=subset(mela3,Skin ==0 s.c == 0 Mucosa ==0 Soft.ti ==0 Ln.peri==0 Ln.med==0 Ln.abdo==0 Lung==0 Liver==0 Other.Visc==0 Bone==0 Marrow==0 Brain==0 Other==0) ## selection of the row with no metastasis localisation nrow(mela4) but i dont now if it is possible to make the same thin as ifelse(mela3,Skin s.c== 0, 0,NA) with more than colomn and after to exclude of my data the Na with na.omit. The last question is how can i omit only the row which are NA value for the colomn metastasis c(11:12,14:21,23,24)) Thank you for your help Bertrand billemont [[alternative text/enriched 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] selection of missing data
I do not quite follow your post but here are some suggestions. 1) You can the na.strings argument to simplify things df - read.delim(file=lala.txt, na.strings=- ) 2) If you can count the number of metastasis per row first, then find the rows with zero sum. met.cols - c(11,12,14,21,23,24) # metastasis columns number.of.met - rowSums( mela[ , met.cols ] == - ) have.no.met - which( number.of.met == 0 ) mela.no.met - mela[ have.no.met , ] If you had coded your - as NA during read in then, the second line needs to be changed to number.of.met - rowSums( is.na( mela[ , met.cols ] ) ) or simply use complete.cases met.cols - c(11,12,14,21,23,24) # metastasis columns mela.no.met - mela[ which( complete.cases(mela[ , met.cols]) ) , ] 3) If you name your columns in a systematic fashion, then you can easily extract and specify those columns. For example if your columns were named cn - c( age, colon.met, PSA.level, prostate.met, gender, hospitalisation.days, status, liver.met, ethnicity) Then you can extract those names ending with .met as met.cols - grep( \\.met$, cn ) met.cols [1] 2 4 8 Regards, Adai On Sun, 2005-11-13 at 18:40 +0100, [EMAIL PROTECTED] wrote: Hi i'm a french medical student, i have some data that i import from excel. My colomn of the datafram are the localisations of metastasis. If there is a metatsasis there is the symbol _. i want to exclude the row without metastasis wich represent the NA data. so, i wrote this mela is the data fram mela1=ifelse(mela[,c(11:12,14:21,23,24)]==_,1,0) # selection of the colomn of metastasis localisation mela4=subset(mela3,Skin ==0 s.c == 0 Mucosa ==0 Soft.ti ==0 Ln.peri==0 Ln.med==0 Ln.abdo==0 Lung==0 Liver==0 Other.Visc==0 Bone==0 Marrow==0 Brain==0 Other==0) ## selection of the row with no metastasis localisation nrow(mela4) but i dont now if it is possible to make the same thin as ifelse(mela3,Skin s.c== 0, 0,NA) with more than colomn and after to exclude of my data the Na with na.omit. The last question is how can i omit only the row which are NA value for the colomn metastasis c(11:12,14:21,23,24)) Thank you for your help Bertrand billemont [[alternative text/enriched 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 __ 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] R for reliability analysis (with censored samples)?
Hello, first: I am a newbie to this list, so if this isn't the right place to ask, thanks for pointing me to the right direction... I'm currently working on adding a degree in RAMS engineering to my general engineering education, and consequently I'm looking for software to get my future work done. This will have to handle mostly right-/left-/intervall-censored samples, which seems to be a non-trivial feature from what I've read and heard so far. Apart from this, RAMS work will be only part of my job and I will be the only one to do RAMS work in the (tiny) company I work for, so paying multi-kEUR every year in license fees for some commercial application will probably not be the preferred choice for us. So I'm planning to use R together with Python and GNUmeric/OO Calc instead. So here are the questions: How suitable is R for this kind of work (reliability analysis)? Does it handle (right-/left-/interval-)censored samples by default? Are there any information sources (on- or off-line) dedicated to the use of open-source software for reliability analysis and especially R? TIA, Sincerely, Wolfgang Keller -- P.S.: My From-address is correct __ 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] assign values
Professor, What does if ((x=2)) 2 mean? Thanks, Robert Peter Dalgaard [EMAIL PROTECTED] wrote: Prof Brian Ripley writes: Please do read the posting guide. The answer to your question can be found by help(-) or help(=). The '-' can be used anywhere, but the '=' is only allowed at the top level (that is, in the complete expression typed by the user) or as one of the subexpressions in a braced list of expressions. If you don't fully understand that, just use - always. The text is not completely accurate though: if ((x=2)) 2 [1] 2 x [1] 2 if (x=2) 2 Error: syntax error in if(x= if(x-2) 2 [1] 2 if(x -2) 2 We do allow = inside parentheses too, it's only in function arguments (where it is ambiguous) and inside conditional clauses (where users might use it incorrectly to test for equality) that we disallow it. As the last example shows, we do leave people to fry in their own fat if they use - for comparisons with negative numbers, though (been there, done that...) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 - [[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] voronoi
It uses FORTRAN code and not in pure R. Renaud Lancelot [EMAIL PROTECTED] wrote:See package tripack. You can find this information with RSiteSearch(voronoi, restrict = functions) Best, Renaud 2005/11/13, Robert : Is there any pure r code to do delaunay or voronoi diagrams? Thanks! - [[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 -- Renaud LANCELOT Département Elevage et Médecine Vétérinaire (EMVT) du CIRAD Directeur adjoint charg?des affaires scientifiques CIRAD, Animal Production and Veterinary Medicine Department Deputy director for scientific affairs Campus international de Baillarguet TA 30 / B (Bât. B, Bur. 214) 34398 Montpellier Cedex 5 - France Tél +33 (0)4 67 59 37 17 Secr. +33 (0)4 67 59 39 04 Fax +33 (0)4 67 59 37 95 - [[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] problem with grid animation
Hi Zepu Zhang wrote: I'm trying to do animation with grid. Basically it's a vector field, like what 'quiver' in Matlab creates. I need to update it with grid.edit(). It seems grid erases the whole thing first, then redraws. Therefore the evident 'flash' between frames. Correct. Any way to avoid this flash? Thanks. There are a couple of ways, but unfortunately they may not be to your taste ... 1) Use windows (where double-buffering has been implemented) 2) Find some way to convince someone to modify the X11 device (or whichever device you are using) to support double-buffering 3) Provide a patch for the X11 device yourself ... Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ 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] voronoi
On Sun, 13 Nov 2005, Robert wrote: It uses FORTRAN code and not in pure R. The same applies to deldir - it also includes Fortran. So the answer seems to be no, there is no voronoi function only written in R. Renaud Lancelot [EMAIL PROTECTED] wrote:See package tripack. You can find this information with RSiteSearch(voronoi, restrict = functions) Best, Renaud 2005/11/13, Robert : Is there any pure r code to do delaunay or voronoi diagrams? Thanks! - [[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 -- Renaud LANCELOT Département Elevage et Médecine Vétérinaire (EMVT) du CIRAD Directeur adjoint charg?des affaires scientifiques CIRAD, Animal Production and Veterinary Medicine Department Deputy director for scientific affairs Campus international de Baillarguet TA 30 / B (Bât. B, Bur. 214) 34398 Montpellier Cedex 5 - France Tél +33 (0)4 67 59 37 17 Secr. +33 (0)4 67 59 39 04 Fax +33 (0)4 67 59 37 95 - [[alternative HTML version deleted]] -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ 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] assign values
Robert [EMAIL PROTECTED] writes: Professor, What does if ((x=2)) 2 mean? Thanks, Robert it assigns 2 to x, then uses the result (i.e. whether it is non-zero) as the condition for the if() construct. So in this case, the condition is always TRUE and the result is always 2. Peter Dalgaard [EMAIL PROTECTED] wrote: Prof Brian Ripley writes: Please do read the posting guide. The answer to your question can be found by help(-) or help(=). The '-' can be used anywhere, but the '=' is only allowed at the top level (that is, in the complete expression typed by the user) or as one of the subexpressions in a braced list of expressions. If you don't fully understand that, just use - always. The text is not completely accurate though: if ((x=2)) 2 [1] 2 x [1] 2 if (x=2) 2 Error: syntax error in if(x= if(x-2) 2 [1] 2 if(x -2) 2 We do allow = inside parentheses too, it's only in function arguments (where it is ambiguous) and inside conditional clauses (where users might use it incorrectly to test for equality) that we disallow it. As the last example shows, we do leave people to fry in their own fat if they use - for comparisons with negative numbers, though (been there, done that...) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 - Yahoo! FareChase - Search multiple travel sites in one click. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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] assign values
Peter Dalgaard [EMAIL PROTECTED] wrote: Robert writes: Professor, What does if ((x=2)) 2 mean? Thanks, Robert it assigns 2 to x, then uses the result (i.e. whether it is non-zero) as the condition for the if() construct. So in this case, the condition is always TRUE and the result is always 2. I see. if ((x=2)) 2 [1] 2 if ((x=0)) 2 - [[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
[R] correlating irregular time series
I have some time stamped events that are supposed to be unrelated. I have plotted them and that assumption does not appear to be valid. http://metrak.com/tmp/sevents.png is a plot showing three sets of events over time. For the purpose of this exercise, the Y value is irrelevant. The series are not sampled at the same time and are not equispaced (just events in a log file). The plot is already pretty convincing but requires a human-in-the-loop to zoom in on hot areas and then visually interpret the result. I want to calculate some index of the events' temporal relationship. I think the question I am trying to ask is something like: If event B occurs, how likely is it that an event A occurred at almost the same time?. Can anyone suggest an established approach that could provide some further insight into this relationship? I can think of a fairly basic approach where I start out with the ecdf of the time differences but I am guessing I would be reinventing some wheel. Any tips would be most appreciated. cheers __ 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] open source and R
Roger Bivand [EMAIL PROTECTED] wrote: On Sun, 13 Nov 2005, Robert wrote: It uses FORTRAN code and not in pure R. The same applies to deldir - it also includes Fortran. So the answer seems to be no, there is no voronoi function only written in R. I am curious about one thing: since the reason for using r is r is a easy-to-learn language and it is good for getting more people involved. Why most of the packages written in r use other languages such as FORTRAN's code? I understand some functions have already been written in other language or it is faster to be implemented in other language. But my understanding is if the user does not know that language (for example, FORTRAN), the package is still a black box to him because he can not improve the package and can not be involved in the development. When I searched the packages of R, I saw many packages with duplicated or similar functions. the main difference among them are the different functions implemented using other languages, which are always a black box to the users. So it is very hard for users to believe the package will run something they need, let alone getting involved in the development. My comments are not to disregard these efforts. But it is good to see the packages written in pure R. - [[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] assign values
On Sun, 13 Nov 2005, Robert wrote: Peter Dalgaard [EMAIL PROTECTED] wrote: Robert writes: Professor, What does if ((x=2)) 2 mean? Thanks, Robert it assigns 2 to x, then uses the result (i.e. whether it is non-zero) as the condition for the if() construct. So in this case, the condition is always TRUE and the result is always 2. I see. if ((x=2)) 2 [1] 2 if ((x=0)) 2 Look at the text above (i.e. whether it is non-zero), and: as.logical(seq(-2,2,1)) and then at your result - numeric x with value 0 is being cast to logical FALSE, so this is as described. - [[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 -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ 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] open source and R
On Sun, 13 Nov 2005, Robert wrote: Roger Bivand [EMAIL PROTECTED] wrote: On Sun, 13 Nov 2005, Robert wrote: It uses FORTRAN code and not in pure R. The same applies to deldir - it also includes Fortran. So the answer seems to be no, there is no voronoi function only written in R. Robert wrote: I am curious about one thing: since the reason for using r is r is a easy-to-learn language and it is good for getting more people involved. Why most of the packages written in r use other languages such as FORTRAN's code? I understand some functions have already been written in other language or it is faster to be implemented in other language. But my understanding is if the user does not know that language (for example, FORTRAN), the package is still a black box to him because he can not improve the package and can not be involved in the development. When I searched the packages of R, I saw many packages with duplicated or similar functions. the main difference among them are the different functions implemented using other languages, which are always a black box to the users. So it is very hard for users to believe the package will run something they need, let alone getting involved in the development. My comments are not to disregard these efforts. But it is good to see the packages written in pure R. Please indent your replies, they are very difficult to read sensibly. Although surprisingly much of R is written in R, quite a lot is written in Fortran and C. One very good reason, apart from efficiency, is code re-use - BLAS and LAPACK among many others are excellent implementations of what we need for numerical linear algebra. R is very typical of good scientific software, it tries to avoid re-implementing functions that are used by the community, are well-supported by the community, and work. Packages by and large do the same - if existing software does the required job, package authors attempt to port that software to R, providing interfaces to underlying C or Fortran libraries. It's about standing on the shoulders of giants. -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ 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] open source and R
If I do not know C or FORTRAN, how can I fully understand the package or possibly improve it? Robert. Roger Bivand [EMAIL PROTECTED] wrote: On Sun, 13 Nov 2005, Robert wrote: Roger Bivand wrote: On Sun, 13 Nov 2005, Robert wrote: It uses FORTRAN code and not in pure R. The same applies to deldir - it also includes Fortran. So the answer seems to be no, there is no voronoi function only written in R. Robert wrote: I am curious about one thing: since the reason for using r is r is a easy-to-learn language and it is good for getting more people involved. Why most of the packages written in r use other languages such as FORTRAN's code? I understand some functions have already been written in other language or it is faster to be implemented in other language. But my understanding is if the user does not know that language (for example, FORTRAN), the package is still a black box to him because he can not improve the package and can not be involved in the development. When I searched the packages of R, I saw many packages with duplicated or similar functions. the main difference among them are the different functions implemented using other languages, which are always a black box to the users. So it is very hard for users to believe the package will run something they need, let alone getting involved in the development. My comments are not to disregard these efforts. But it is good to see the packages written in pure R. Please indent your replies, they are very difficult to read sensibly. Although surprisingly much of R is written in R, quite a lot is written in Fortran and C. One very good reason, apart from efficiency, is code re-use - BLAS and LAPACK among many others are excellent implementations of what we need for numerical linear algebra. R is very typical of good scientific software, it tries to avoid re-implementing functions that are used by the community, are well-supported by the community, and work. Packages by and large do the same - if existing software does the required job, package authors attempt to port that software to R, providing interfaces to underlying C or Fortran libraries. It's about standing on the shoulders of giants. -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] - [[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
[R] Robust Non-linear Regression
Hi, I'm trying to use Robust non-linear regression to fit dose response curves. Maybe I didnt look good enough, but I dind't find robust methods for NON linear regression implemented in R. A method that looked good to me but is unfortunately not (yet) implemented in R is described in http://www.graphpad.com/articles/RobustNonlinearRegression_files/frame.htm http://www.graphpad.com/articles/RobustNonlinearRegression_files/frame.htm in short: instead of using the premise that the residuals are gaussian they propose a Lorentzian distribution, in stead of minimizing the squared residus SUM (Y-Yhat)^2, the objective function is now SUM log(1+(Y-Yhat)^2/ RobustSD) where RobustSD is the 68th percentile of the absolute value of the residues my question is: is there a smart and elegant way to change to objective function from squared Distance to log(1+D^2/Rsd^2) ? or alternatively to write this as a weighted non-linear regression where the weights are recalculated during the iterations in nlme it is possible to specify weights, possibly that is the way to do it, but I didn't manage to get it working the weights should then be something like: SUM (log(1+(resid(.)/quantile(all_residuals,0.68))^2)) / SUM (resid(.)) the test data I use : x-seq(-5,-2,length=50) x-rep(x,4) y-SSfpl(x,0,100,-3.5,1) y-y+rnorm(length(y),sd=5) y[sample(1:length(y),floor(length(y)/50))]-200 # add 2% outliers at 200 thanks a lot Hans Vermeiren [[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] open source and R
On Sun, 13 Nov 2005, Robert wrote: If I do not know C or FORTRAN, how can I fully understand the package or possibly improve it? By learning enough to see whether that makes a difference for your purposes. Life is hard, but that's what makes life interesting ... Robert. Roger Bivand [EMAIL PROTECTED] wrote: On Sun, 13 Nov 2005, Robert wrote: Roger Bivand wrote: On Sun, 13 Nov 2005, Robert wrote: It uses FORTRAN code and not in pure R. The same applies to deldir - it also includes Fortran. So the answer seems to be no, there is no voronoi function only written in R. Robert wrote: I am curious about one thing: since the reason for using r is r is a easy-to-learn language and it is good for getting more people involved. Why most of the packages written in r use other languages such as FORTRAN's code? I understand some functions have already been written in other language or it is faster to be implemented in other language. But my understanding is if the user does not know that language (for example, FORTRAN), the package is still a black box to him because he can not improve the package and can not be involved in the development. When I searched the packages of R, I saw many packages with duplicated or similar functions. the main difference among them are the different functions implemented using other languages, which are always a black box to the users. So it is very hard for users to believe the package will run something they need, let alone getting involved in the development. My comments are not to disregard these efforts. But it is good to see the packages written in pure R. Please indent your replies, they are very difficult to read sensibly. Although surprisingly much of R is written in R, quite a lot is written in Fortran and C. One very good reason, apart from efficiency, is code re-use - BLAS and LAPACK among many others are excellent implementations of what we need for numerical linear algebra. R is very typical of good scientific software, it tries to avoid re-implementing functions that are used by the community, are well-supported by the community, and work. Packages by and large do the same - if existing software does the required job, package authors attempt to port that software to R, providing interfaces to underlying C or Fortran libraries. It's about standing on the shoulders of giants. -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ 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] Robust Non-linear Regression
you might consider nlrq() in the quantreg package, which does median regression for nonlinear response functions url:www.econ.uiuc.edu/~rogerRoger Koenker email [EMAIL PROTECTED] Department of Economics vox:217-333-4558University of Illinois fax:217-244-6678Champaign, IL 61820 On Nov 13, 2005, at 3:47 PM, Vermeiren, Hans [VRCBE] wrote: Hi, I'm trying to use Robust non-linear regression to fit dose response curves. Maybe I didnt look good enough, but I dind't find robust methods for NON linear regression implemented in R. A method that looked good to me but is unfortunately not (yet) implemented in R is described in http://www.graphpad.com/articles/RobustNonlinearRegression_files/ frame.htm http://www.graphpad.com/articles/RobustNonlinearRegression_files/ frame.htm in short: instead of using the premise that the residuals are gaussian they propose a Lorentzian distribution, in stead of minimizing the squared residus SUM (Y-Yhat)^2, the objective function is now SUM log(1+(Y-Yhat)^2/ RobustSD) where RobustSD is the 68th percentile of the absolute value of the residues my question is: is there a smart and elegant way to change to objective function from squared Distance to log(1+D^2/Rsd^2) ? or alternatively to write this as a weighted non-linear regression where the weights are recalculated during the iterations in nlme it is possible to specify weights, possibly that is the way to do it, but I didn't manage to get it working the weights should then be something like: SUM (log(1+(resid(.)/quantile(all_residuals,0.68))^2)) / SUM (resid (.)) the test data I use : x-seq(-5,-2,length=50) x-rep(x,4) y-SSfpl(x,0,100,-3.5,1) y-y+rnorm(length(y),sd=5) y[sample(1:length(y),floor(length(y)/50))]-200 # add 2% outliers at 200 thanks a lot Hans Vermeiren [[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 __ 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] open source and R
On Nov 13, 2005, at 3:24 PM, Robert wrote: I am curious about one thing: since the reason for using r is r is a easy-to-learn language and it is good for getting more people involved. Why most of the packages written in r use other languages such as FORTRAN's code? I understand some functions have already been written in other language or it is faster to be implemented in other language. But my understanding is if the user does not know that language (for example, FORTRAN), the package is still a black box to him because he can not improve the package and can not be involved in the development. When I searched the packages of R, I saw many packages with duplicated or similar functions. the main difference among them are the different functions implemented using other languages, which are always a black box to the users. So it is very hard for users to believe the package will run something they need, let alone getting involved in the development. No, the box is not black, it is utterly transparent. Of course, what you can recognize and understand inside depends on you,. Just say no to linguistic chauvinism -- even R-ism. url:www.econ.uiuc.edu/~rogerRoger Koenker email [EMAIL PROTECTED] Department of Economics vox:217-333-4558University of Illinois fax:217-244-6678Champaign, IL 61820 __ 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] open source and R
On Sun, 13 Nov 2005, Roger Bivand wrote: On Sun, 13 Nov 2005, Robert wrote: If I do not know C or FORTRAN, how can I fully understand the package or possibly improve it? By learning enough to see whether that makes a difference for your purposes. Life is hard, but that's what makes life interesting ... None of us fully understands what we are doing with computer software. If you understand R code, that's great, but then there is the R interpreter -- do you understand how it works? That interpreter was written in another language that was then compiled by a compiler which was written by someone else for some other purpose -- do you understand the compiler? Then it all gets processed by some very complex hardware that practically none of us *fully* understands. We have to accept that we can't have a complete grasp of what R is doing, but we can still read the R docs and test R in many ways. When functions are written in R, they may be easier for you to read, but they may run much slower than code written in C, C++ or FORTRAN. I don't think it is wise to forgo the speed improvement so that people who don't know FORTRAN can enjoy contributing to R development. The contribution of FORTRAN libraries R functionality and efficiency is probably much greater than the contributions would be from any group of people who could code in R but could't code in C or FORTRAN. That said, I appreciate the sentiment and I think we should prefer straight R code for many functions, but some things just run too slowly when written that way. Mike __ 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] open source and R
On 13-Nov-05 Roger Bivand wrote: On Sun, 13 Nov 2005, Robert wrote: If I do not know C or FORTRAN, how can I fully understand the package or possibly improve it? By learning enough to see whether that makes a difference for your purposes. Life is hard, but that's what makes life interesting ... Robert. Roger Bivand [EMAIL PROTECTED] wrote: On Sun, 13 Nov 2005, Robert wrote: Roger Bivand wrote: On Sun, 13 Nov 2005, Robert wrote: It uses FORTRAN code and not in pure R. The same applies to deldir - it also includes Fortran. So the answer seems to be no, there is no voronoi function only written in R. Robert wrote: I am curious about one thing: since the reason for using r is r is a easy-to-learn language and it is good for getting more people involved. Why most of the packages written in r use other languages such as FORTRAN's code? I understand some functions have already been written in other language or it is faster to be implemented in other language. But my understanding is if the user does not know that language (for example, FORTRAN), the package is still a black box to him because he can not improve the package and can not be involved in the development. When I searched the packages of R, I saw many packages with duplicated or similar functions. the main difference among them are the different functions implemented using other languages, which are always a black box to the users. So it is very hard for users to believe the package will run something they need, let alone getting involved in the development. My comments are not to disregard these efforts. But it is good to see the packages written in pure R. Although surprisingly much of R is written in R, quite a lot is written in Fortran and C. One very good reason, apart from efficiency, is code re-use - BLAS and LAPACK among many others are excellent implementations of what we need for numerical linear algebra. R is very typical of good scientific software, it tries to avoid re-implementing functions that are used by the community, are well-supported by the community, and work. Packages by and large do the same - if existing software does the required job, package authors attempt to port that software to R, providing interfaces to underlying C or Fortran libraries. It's about standing on the shoulders of giants. Those are very strong points. Some comments: It would be possible to implement in pure R a matrix inversion or eigenvalue/vector function, for instance, and I'm sure it would be done (if it were done) to very high quality. However, it would run like an elephant in quicksands. BLAS and LAPACK have, over the years, become highly optimised not just for accuracy and robustness, but for speed and efficiency. Also, you will hit the other language problem sooner or later. Robert's complaint is that he does not like black boxes. But R itself is a black box. You cannot write R in R, all the way down to the bottom. At the bottom is machine code, and languages like assember, C, C++, FORTRAN and their compilers provide black box wrappers for this. That is not a whimsical comment either -- all those discussions about why 2 - sqrt(2)^2 is not equal to 0 come down to this sort of issue. Sooner or later, if you really want to understand what is going on, you have to get beneath the shiny smooth surface and swim amongst the molecules! So, Robert, try to be positive about C and FORTRAN etc., rather than feeling put off by the fact that they are yet more things to learn and seem to get in the way of understanding how the functions work. C and FORTRAN are your friends, as well as the R langauge itself, and great deal more friemdly than the raw machine code. There is one aspect though where R users are in the cold when it comes to C and FORTAN. If you want to understand the function 'eigen', say, then you can ?eigen to learn about its usage. You can enter eigen to see the R code, and indeed that is not too imcomprehensible. But then you find .Fortran(ch, n, n, xr, xi, values = dbl.n, !only.values, vectors = xr, ivectors = xi, dbl.n, dbl.n, double(2 * n), ierr = integer(1), PACKAGE = base) and similar for rs, cg and rg. Where's the help for these? Nowhere obvious! In fact you have to go to the source code, locate the FORTRAN routines, and study these, hoping that enough helpful comments have been included to steer your study. So it is a much more formidable task, especially if you are having to learn the language at the same time. Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 13-Nov-05 Time: 23:13:58 -- XFMail -- __ R-help@stat.math.ethz.ch
[R] poker package -- comments?
Over the weekend I wrote a small package to evaluate poker hands and to do some small simulations with them. If anyone is interested in looking at it, I'd appreciate comments and/or contributions. The package is available at http://www.stats.uwo.ca/faculty/murdoch/software. (Look at the bottom of the list.) So far only the Texas Hold'em variation has been programmed. There's support for wild cards and fairly general schemes of putting together hands for evaluation, so it wouldn't be too hard to add other games. There's no support for betting or simulating different strategies, but again, if you want to write that, it should be possible. Here's a quick example, where I've asked it to simulate hands until it came up with one I won. In the first case I start with a pair of aces and won on the first hand; in the second another player started with aces, and it took 7 hands to find me a winner. poker select.hand(pocket = card(Ah As), players = 4) Showing: 4H 3S 2D 6S 4C Rank Name Cards Value 11 Self AH AS Two pair 221 8S 3C Two pair 332 QD KH Pair of 4s 443 8H 9D Pair of 4s Would win 4 person game Required 1 hand. poker select.hand(players = list(card(Ah As), NULL, NULL)) Showing: AD 4H 7D 2C 8S Rank Name Cards Value 11 Self 6H 5HStraight 221 AH AS 3 of a kind 332 AC 3C Pair of As 443 9D 6D A high Would win 4 person game Required 7 hands. Duncan Murdoch __ 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] R for reliability analysis (with censored samples)?
On Sun, 13 Nov 2005, Wolfgang Keller wrote: So here are the questions: How suitable is R for this kind of work (reliability analysis)? Does it handle (right-/left-/interval-)censored samples by default? The survreg() function in the survival package fits accelerated failure models to right/left/interval censored data. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ 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] open source and R
Thanks for all the nice discussions. Though different users have various needs from R, It's always good to stand on the shoulders of giants (as roger said). How far we will see depends our ability to understand what have been done by other languages. The package written in pure R might be good for education in starting OOP in research but not effective in scientific computing as suggested. [EMAIL PROTECTED] wrote: On 13-Nov-05 Roger Bivand wrote: On Sun, 13 Nov 2005, Robert wrote: If I do not know C or FORTRAN, how can I fully understand the package or possibly improve it? By learning enough to see whether that makes a difference for your purposes. Life is hard, but that's what makes life interesting ... Robert. Roger Bivand wrote: On Sun, 13 Nov 2005, Robert wrote: Roger Bivand wrote: On Sun, 13 Nov 2005, Robert wrote: It uses FORTRAN code and not in pure R. The same applies to deldir - it also includes Fortran. So the answer seems to be no, there is no voronoi function only written in R. Robert wrote: I am curious about one thing: since the reason for using r is r is a easy-to-learn language and it is good for getting more people involved. Why most of the packages written in r use other languages such as FORTRAN's code? I understand some functions have already been written in other language or it is faster to be implemented in other language. But my understanding is if the user does not know that language (for example, FORTRAN), the package is still a black box to him because he can not improve the package and can not be involved in the development. When I searched the packages of R, I saw many packages with duplicated or similar functions. the main difference among them are the different functions implemented using other languages, which are always a black box to the users. So it is very hard for users to believe the package will run something they need, let alone getting involved in the development. My comments are not to disregard these efforts. But it is good to see the packages written in pure R. Although surprisingly much of R is written in R, quite a lot is written in Fortran and C. One very good reason, apart from efficiency, is code re-use - BLAS and LAPACK among many others are excellent implementations of what we need for numerical linear algebra. R is very typical of good scientific software, it tries to avoid re-implementing functions that are used by the community, are well-supported by the community, and work. Packages by and large do the same - if existing software does the required job, package authors attempt to port that software to R, providing interfaces to underlying C or Fortran libraries. It's about standing on the shoulders of giants. Those are very strong points. Some comments: It would be possible to implement in pure R a matrix inversion or eigenvalue/vector function, for instance, and I'm sure it would be done (if it were done) to very high quality. However, it would run like an elephant in quicksands. BLAS and LAPACK have, over the years, become highly optimised not just for accuracy and robustness, but for speed and efficiency. Also, you will hit the other language problem sooner or later. Robert's complaint is that he does not like black boxes. But R itself is a black box. You cannot write R in R, all the way down to the bottom. At the bottom is machine code, and languages like assember, C, C++, FORTRAN and their compilers provide black box wrappers for this. That is not a whimsical comment either -- all those discussions about why 2 - sqrt(2)^2 is not equal to 0 come down to this sort of issue. Sooner or later, if you really want to understand what is going on, you have to get beneath the shiny smooth surface and swim amongst the molecules! So, Robert, try to be positive about C and FORTRAN etc., rather than feeling put off by the fact that they are yet more things to learn and seem to get in the way of understanding how the functions work. C and FORTRAN are your friends, as well as the R langauge itself, and great deal more friemdly than the raw machine code. There is one aspect though where R users are in the cold when it comes to C and FORTAN. If you want to understand the function 'eigen', say, then you can ?eigen to learn about its usage. You can enter eigen to see the R code, and indeed that is not too imcomprehensible. But then you find .Fortran(ch, n, n, xr, xi, values = dbl.n, !only.values, vectors = xr, ivectors = xi, dbl.n, dbl.n, double(2 * n), ierr = integer(1), PACKAGE = base) and similar for rs, cg and rg. Where's the help for these? Nowhere obvious! In fact you have to go to the source code, locate the FORTRAN routines, and study these, hoping that enough helpful comments have been included to steer your study. So it is a much more formidable task, especially if you are having to learn the language at the same time.
Re: [R] open source and R
On Sun, 13 Nov 2005 [EMAIL PROTECTED] wrote: [...] There is one aspect though where R users are in the cold when it comes to C and FORTAN. If you want to understand the function 'eigen', say, then you can ?eigen to learn about its usage. You can enter eigen to see the R code, and indeed that is not too imcomprehensible. But then you find .Fortran(ch, n, n, xr, xi, values = dbl.n, !only.values, vectors = xr, ivectors = xi, dbl.n, dbl.n, double(2 * n), ierr = integer(1), PACKAGE = base) and similar for rs, cg and rg. Where's the help for these? Nowhere obvious! In fact you have to go to the source code, locate the FORTRAN routines, and study these, hoping that enough helpful comments have been included to steer your study. So it is a much more formidable task, especially if you are having to learn the language at the same time. That is an unfair comment. The help page for eigen explains what routines are used and gives you references to books describing them. So the help _is_ in the most obvious place. -- 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 __ 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