[R] CLI Issue
Hello, I have a script that must be executed by R at the CLI completely ... without halting execution on encountering an error (object not found). Rcmdr works fine, but source behaves strangely in R-2.1... Thanks, -- A. Mani Member, Cal. Math. Soc [[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] glm automation
Hello, I have two problems in automating multiple glm(s) operations. The data file is tab delimited file with headers and two columns. like ABC EFG 1 2 2 3 3 4 dat - read.table(FILENAME, header=TRUE, sep=\t, na.strings=NA, dec=., strip.white=TRUE) dataf - read.table(FILENAME, header=FALSE, sep=\t, na.strings=NA, dec=., strip.white=TRUE) norm1 - glm(dataf[1,1] ~ dataf[1,2], family= normal(log), data=dat) norm2 - glm(dataf[1,1] ~ dataf[1,2], family= normal(identity), data=dat) and so on. But glm does not work on the data unless I write ABC and EFG there... I want to automate the script for multiple files. The other problem is to write the plot(GLM) to a file without displaying it at stdout. Thanks, A. Mani Member, Cal. Math. Soc [[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] Strange Expression
Hello, I have a dataframe with a column 'col' of expressions of the form 2*3+4*5+6*7 and substrings thereof. Now eval(2*3+4*5+6*7) is ok. But I want it done on that column... nothing seems to work Even cil - dataframe$col eval(cil[1]) 2*3+4*5+6*7 I want the elements of the column evaluated. Thanks, A. Mani Member, Cal. Math. Soc [[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] Strange Expression
On 3/3/06, ¨Tariq Khan [EMAIL PROTECTED] wrote: Did you try eval(parse(text = cil[1])) ? yes, function (x) eval(parse(x)) works within the *apply commands. thanks, -- A. Mani Member, Cal. Math. Soc [[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 with ldBands(Hmisc)
Hello My Fellow Users, Under the details it is given that the ld98 executable should be in a subdirectory that is in the system. Should ld98.exe be included under Hmisc (where it is stored) or under the lib subdirectory within Hmisc? I am getting the following error message: Error in (head + 1):length(w) : NA/NaN argument. Does this mean that I didn't store the ld98.exe in the right place or something else? Please help. Mani __ 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] Clustering Large Data Sets
Hello, Suppose the problem is to cluster each document in a set of 'n' documents (.csv) separately by some clustering method. If 'n' is very large, then is there a method of increasing speed and efficiency by treating the set as a document vector or as a set of document vectors ? Thanks -- A. Mani Member, Cal. Math. Soc __ 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] Unpaste Problem
Hello, Easy ways to unpaste? xp - paste(x2, x3) # x2, x3 are two non-numeric columns. . . xfg - data.frame(xp,sc1, sc2, sc3) # sc1,sc2, sc3 are numeric cols. I want xp to be split up to form a new dataframe of the form (x3, sc1, sc2, sc3). IMPORTANT info : elements of xp have the form abcspaceefg, with abc in x2 and efg in x3. Thanks in advance, -- A. Mani Member, Cal. Math. Soc __ 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] A. Mani : Tapply
Hello, Is it safe to use tapply when the result will be of dim 2 x 1 or more ? In my PC R crashes. The code used was on a 3-col data frame with two factor cols and a numeric column. The fn was diff . data form being A, B, Num tapply(data$A, list(data$A, data$B), diff) -- A. Mani Member, Cal. Math. Soc __ 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] Re : A. Mani : Avoiding Loops
On Friday 19 August 2005 11:54, Sean O'Riordain wrote: Hi, I'm not sure what you actually want from your email (following the posting guide is a good way of helping you explain things to the rest of us in a way we understand - it might even answer your question! I'm only a beginner at R so no doubt one of our expert colleagues will help me... fred - data.frame() fred - edit(fred) fred A B C D E 1 1 2 X Y 1 2 2 3 G L 1 3 3 1 G L 5 fred[,3] [1] X G G Levels: G X fred[fred[,3]==G,] A B C D E 2 2 3 G L 1 3 3 1 G L 5 so at this point I can create a new dataframe with column 3 (C) == G; either explicitly or implicitly... and if I want to calculate the sum() of column E, then I just say something like... sum(fred[fred[,3]==G,][,5]) [1] 6 now naturally being a bit clueless at manipulating stuff in R, I didn't know how to do this before I started... and you guys only get to see the lines that I typed in and got a successful result... according to section 6 of the Introduction to R manual which comes with R, I could also have said sum(fred[fred$C==G,]$E) [1] 6 Hmmm I wonder would it be reasonable to put an example of this type into section 2.7 of the Introduction to R? cheers! Sean On 18/08/05, A. Mani [EMAIL PROTECTED] wrote: Hello, I want to avoid loops in the following situation. There is a 5-col dataframe with col headers alone. two of the columns are non-numeric. The problem is to calculate statistics(scores) for each element of one column. The functions depend on matching in the other non-numeric column. A B C E F 1 2 X Y 1 2 3 G L 1 3 1 G L 5 and so on ...3+ entries. I need scores for col E entries which depend on conditional implications. Thanks, Hello, Sorry about the incomplete problem. Here is a better version for the problem: (the measure is not simple) The data frame is like col1 col2col3 col4col5 num nonum nonum num num A B C E F There are repeated strings in col3, col2. Problem : Calculate Measure(Ci) = [No. of repeats of Ci *100] + [If (Bi, Ci) is same as (Bj, Cj) and 6= Ej - Ei =3 then add 100 else 10] . Actually it is to stretched further by adding similar blocks. How do we use *apply or something else in the situation ? In prolog it is extremely easy, but here it is not quite... A. Mani Member, Cal. Math. Soc -- A. Mani Member, Cal. Math. Soc __ 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] A. Mani : Avoiding loops
Hello, I want to avoid loops in the following situation. There is a 5-col dataframe with col headers alone. two of the columns are non-numeric. The problem is to calculate statistics(scores) for each element of one column. The functions depend on matching in the other non-numeric column. A B C E F 1 2 X Y 1 2 3 G L 1 3 1 G L 5 and so on ...3+ entries. I need scores for col E entries which depend on conditional implications. Thanks, A. Mani Member, Cal. Math. Soc __ 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-help Digest, Vol 28, Issue 28
On Tuesday 28 June 2005 15:30, [EMAIL PROTECTED] wrote: Re : 37. Re: A. Mani : colours in Silhouette (Mulholland, Tom) Message: 37 Date: Tue, 28 Jun 2005 09:08:24 +0800 From: Mulholland, Tom [EMAIL PROTECTED] Subject: Re: [R] A. Mani : colours in Silhouette To: [EMAIL PROTECTED], r-help@stat.math.ethz.ch Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 It's not so much a problem, as not working the way you expected. cluster:::plot.partition is used to do the plotting. If you look at the code for this you can see the difficulty in putting every possible permutation into the code. If for example you want the silhouette plot to be red using col = red is not intuitive as the cluster plot (which comes up first) has more than one colour. If you have a look at methods(plot) (assuming that you have loaded the cluster package) you will see that there is a specific piece of code in the form of plot.silhouette. It has an asterisk next to it so you need to use cluster:::plot.silhouette to see the code. It has what you need. args(cluster:::plot.silhouette) function (x, nmax.lab = 40, max.strlen = 5, main = NULL, sub = NULL, xlab = expression(Silhouette width * s[i]), col = gray, do.col.sort = length(col) 1, border = 0, cex.names = par(cex.axis), do.n.k = TRUE, do.clus.stat = TRUE, ...) data(ruspini) pr4 - pam(ruspini, 4) si - silhouette(pr4) plot(si,col = red) I tried that before with many more options and got a blank image. It must have been due to the options. The issue is that whenever code is written there is always a choice as to what functionality is put in place. Just because something can be done, does not mean it will or in some cases should be done. In this case the help for plot.partition notes that For more flexibility, use 'plot(silhouette(x), ...)', see 'plot.silhouette'. Tom Thanks for that I found out something I will find useful in the future. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of A. Mani Sent: Tuesday, 28 June 2005 4:30 AM To: r-help@stat.math.ethz.ch Subject: [R] A. Mani : colours in Silhouette Hello, In cluster analysis with cluster, how does one colour the silhouette plots ? For example in using pam. There seems to be some problem there. Everything else can be coloured. Thanks, A. Mani Member, Cal. Math. Soc __ 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] A. Mani : colours in Silhouette
Hello, In cluster analysis with cluster, how does one colour the silhouette plots ? For example in using pam. There seems to be some problem there. Everything else can be coloured. Thanks, A. Mani Member, Cal. Math. Soc __ 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] A. Mani : Read
Hello, What is the best way to read a .rdat file with data in the following form : $xyz1 column names columns(numeric) $xyz2 column names columns(numeric) $xyz3 column names columns(numeric) and so on. A. Mani Member, Cal. Math. Soc __ 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