Re: [R] help on ks.test and shapiro.test
Wen Zhang wrote: I have three files of data which are available at http://zhangw.com/ R/, varied at the number of data. I tried to use R to analyze using shapiro.test, ks.test, and t.test. t.test ran as expected, however, when I run shapiro.test and ks.test commands, error message always occurred. Error message for shapiro.test is Error in [.data.frame(x, complete.cases(x)) : undefined columns selected ks.test is Error in ks.test(control) : argument y is missing, with no default As a newcomer to R, I don't know how to deal with this. Can anyone help me? Please start reading the posting guide and the help files of those functions. Without you giving a reproducible example, we cannot help that much. Uwe Ligges --- --- Life is a foreign language; all man mispronouce it. ---Christopher Morley 终于,那野兽倒下了,异教徒们为此而欢庆。 但是 一切并未结束,因为一只巨鸟已从灰烬中诞生。那鸟 从空中俯视着异教徒们,向他们施放火与雷电。因为 这野兽已重生为巨鸟,恢复了力量。金钱的追随者们 在恐惧中后退。 Mozilla 之书, 7:15 My Blog: http://zhangw.com/wp/ Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird __ 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] unprecise question on read.table() and the nortest package; was: (no subject)
Wendy Peng wrote: Hi there, I am trying to perform different normality tests in R. I have no problem when I use Shapiro.test( ). However, when I try to use any normality tests from the Nortest package, I kept getting this error Error in read.table(source, header = T, fill = T) : 'file' must be a character string or connection. I have no idea why because there was no problem with the read.table () in the Shapiro.test(). I had installed Nortest package already. Please start reading the posting guide and the help files of those functions. Note that using a subject line on a high traffic mailing list should be mandatory. Without you giving a reproducible example, we cannot help that much. Uwe Ligges Thank you Wendy Peng BC Cancer Agency Cancer Genetics Department Co-p Programmer [[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] dev.copy legend problem
Thanks for the answer. The problem we are facing is that we dev.copy to a pdf device and then, the legend doesn't look the same: numbers overlap a little lines. I suspect that this is what you are experiencing. yes it seems to be If you want to end up with a PDF plot, use pdf() and set the various plotting parameters (ie. font size, etc.) based upon what you see there, not what you see on the screen or in another device. we plot the graphs on the postscript device (because on the server I work X11 is unfortunately not available), and after we copy from postscript device to both pdf (dev.copy) and bitmap (dev2bitmap) device (.png file at the end). So the graphs look OK on png image but not on the pdf ; I will try to set parameters on pdf() One other possibility, just to throw it out there since you are on Linux, is to use ps2pdf from a console to convert the PS file to PDF. Thanks for this, I already used 'ps2pdf' before, but in this way I can't because: - I do several graphics in the script, each of them is drawn on the postscript device, copied to bitmap and pdf, then the postscript device is shut down but not the pdf one, which presents all the graphics in one file (several pages) at the end. - the script has to be a cross platform one... Thanks again, I try settings on pdf() and tell you, Florence. [[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] changing figure size in Sweave
TEMPL Matthias wrote: Use \setkeys{Gin} to modify figure sizes or use explicit \includegraphics commands in combination with Sweave option include=FALSE. Or use \documentclass[nogin,...]{...}. Then the 'Gin' will have no effect, and the size of the plots in the document will not be changed from the size given as ...,height=??,width=?? (i.e. the size produced by R). -- Bjørn-Helge Mevik __ 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] Fitting model with varying number of predictors
On Fri, 18 Nov 2005, Juni Joshi wrote: I need to fit a number of models with different number of predictors in each model. Say for example, I have three predictors: x1, x2, x3 and I want to fit three models: lm(y~x1+x2) lm(y~x2+x3) lm(y~x1+x2+x3) Instead of typing all models, what I want is to create a variable which can take the right hand side of the models. I tried this with paste function. xxx - paste(x1,x2,sep=+) for the first This gives a syntax error! xxx - paste(x2,x3, sep = +) for the second xxx - paste(x1,x2,x2, sep = +) for the third and then fit a single model lm(y~xxx) It did not work. Please suggest how to do it. You want a formula here, and you also need to use code without syntax errors. For example xxx - paste(x1, x2, sep=+) lm(as.formula(paste(y ~, xxx))) But a better idea would be to put all your variables into a data frame DF and do use - c(x1, x2) # set as appropriate lm(y ~ ., data=DF[c(y, use)]) -- 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] Point pattern to grid
On Thu, 17 Nov 2005, Leaf Sun wrote: Dear all, I'd like to change a point pattern to a grid of cells and use one of the variables as the output. e.g. The point pattern is of a window of (500*500) and several features such as pH, SoilType etc. I like to divide it into a grid with cell size 5*5, and use the mean of the point values falling inside the cell as the output. Is there any package in R working with this? Thanks in advance! This might have been better posted on R-sig-geo. Try this: library(sp) df1 - data.frame(x=runif(1,0,500), y=runif(1,0,500), z=rnorm(1)) coordinates(df1) - c(x, y) summary(df1) # SpatialPointsDataFrame grd - GridTopology(c(2.5,2.5), c(5,5), c(100,100)) sgrd - SpatialGrid(grd) #SpatialGrid bbox(sgrd) res - overlay(sgrd, df1) # find which grid cells the points are in str(res) try0 - lapply(split(as(df1, data.frame), res), mean) # take means by grid cell - assumes all numeric columns in df1 # (soil type??) - maybe write a custom function to handle non-numeric # columns sensibly try01 - vector(mode=list, length=prod(slot(slot(sgrd, grid), cells.dim))) nafill - rep(as.numeric(NA), ncol(as(df1, data.frame))) try01 - lapply(try01, function(x) nafill) # make a container to put the means in with the right number of columns try01[as.integer(names(try0))] - try0 # insert means into correct list elements try1 - data.frame(t(data.frame(try01))) # transpose summary(try1) sgrd1 - SpatialGridDataFrame(slot(sgrd, grid), try1) image(sgrd1, x) image(sgrd1, y) image(sgrd1, z) It goes a bit further than the short description of the sp package in the latest R-News, and will most likely be a new method for overlay in sp. If these are your 200K points, it may take a little longer ... Cheers, Leaf -- 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] Fitting model with varying number of predictors
try : my_formula = as.formula(paste(y~,xxx)) lm(my_formula) note that you can play with substr in paste to change your formula paste(y~,substr(xxx,1,5)) [1] y~ x1+x2 paste(y~,substr(xxx,4,8)) [1] y~ x2+x3 furthermore, with 10 predictors x1 x2 ...x10 for instence, you can create 2 array of indice where to start and end the substr and do it in a loop for multi fit... best, yves On 11/18/05, Juni Joshi [EMAIL PROTECTED] wrote: I need to fit a number of models with different number of predictors in each model. Say for example, I have three predictors: x1, x2, x3 and I want to fit three models: lm(y~x1+x2) lm(y~x2+x3) lm(y~x1+x2+x3) Instead of typing all models, what I want is to create a variable which can take the right hand side of the models. I tried this with paste function. xxx - paste(x1,x2,sep=+) for the first xxx - paste(x2,x3, sep = +) for the second xxx - paste(x1,x2,x2, sep = +) for the third and then fit a single model lm(y~xxx) It did not work. Please suggest how to do it. Thanks. Jun __ 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 [[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] dev.copy legend problem
On 11/17/05, Prof Brian Ripley [EMAIL PROTECTED] wrote: That's why we recommend that you do not use dev.copy but replot on the target device. as I plot the graph in the postscript device, and then want to save it into both pdf and png files, I prefer using dev.copy because it allows me to avoid replot the same graph two times. According to the help page for dev.copy you cannot by default copy from postscript() to pdf(). Is that really what you are doing? It seems to work for me once I enable copying, as those two devices do share fonts. yes, you are right, we do: dev.control(enable) Thanks, Florence. On Thu, 17 Nov 2005, Florence Combes wrote: We are facing this problem for long, and so ask for your help. We are plotting 2 graphs in a postscript device (left part -layout function-), and the common legend for these graphs on the right part. The legend in the postscript device looks ok: this is color lines with numbers on the right (6 columns) , see the code below: nblock-c(1:48) leg-paste(c(1:npin), ,sep= ) legend(0,19,legend = leg, col=rainbow(nblock), lty=1, merge=TRUE,ncol=6,bty=n,cex=0.6) The problem we are facing is that we dev.copy to a pdf device and then, the legend doesn't look the same: numbers overlap a little lines. Has someone already encountered such a thing ? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/http://www.stats.ox.ac.uk/%7Eripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 [[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] Morans I for Spatial Surveillance
On Thu, 17 Nov 2005, Serryn Eagleson wrote: Hello, I am interested in using Morans I for different time intervals to detect disease clusters. Ultimately I would like to use CUSUM - or similar monitoring statistic to monitor the results of Morans I - similar to the work by Rogerson (2005) Spatial Surveillance and Cummulative Sum Methods in Spatial and Syndromic Surveillance for Public Health. Thus far - thanks to the list I have Morans I running in a loop for each day (however I found that on some days no data is recorded, this caused an error to get around this error I included an elseif statement to skip the calculation for days where no disease notifications are recorded.) Please consider posting on R-sig-geo (see the Spatial Task View for address) rather than this general list. The book with Rogerson's chapter isn't yet available everywhere - not reached Norwegian university libraries yet (journal articles are much more accessible from e-journals than book chapters), so a very small number of people will know what you are interested in. If you want to follow this up, you'll have to be more specific. The strucchange package has some interesting functions for these issues, but you'll have to explain what Rogerson proposes. I am just wondering if anyone has code/advice for the best way to apprach the next stage of monitoring Morans I over different time intervals for the detection of abnormal clusters. My code thus far is below - I would also like to assemble the results in a neat table if anyone has tips for this I would alo appreciate it as I am rather new to R! Thanks Serryn T1-read.dbf(ob.dbf) N - colnames(T1) T2nb - read.gal(PC.gal,override=TRUE) col.W - nb2listw(T2nb, style=W) for(i in seq(N)) { Vec1 - spNamedVec(N[i+7], T1) Svec1-sum(Vec1) ifelse ( Svec1 0, res[i]-moran.test(spNamedVec(N[i+7], T1), col.W, zero.policy=TRUE), res[i]-NULL) } print(res) [[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
[R] Compiled name to object
Hi, I have a tricky problem with composing a name that should represent an object: I want to pass a data frame and a string that contains a column name to a function, e.g.: check(testFrame, seconds) The function should now divide the testFrame into two subsets and call a t-test on the numbers that are in the given column: check - function(frame, column) { sessionNo - c(s01, s02, s03, s04, s05, s06) earlySessions - subset(frame, frame$session %in% sessionNo) lateSessions - subset(frame, !frame$session %in% sessionNo) t.test(earlySessions$column, lateSessions$column) } How can I get R to change earlySessions$column to whatever was passed as string, in the above example earlySessions$seconds? Thanks for any hint. 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
[R] repeated %in%
Hi I have a list of vectors, each one of which should be a subset of the previous one. How do I check that this property actually holds? Toy problem follows with a list of length 4 but my list can be any length subsets - list( l1 = 1:10 , l2 = seq(from=1,to=9,by=2), l3 = c(3,7), l4 = 3 ) I need all(subsets[[4]] %in% subsets[[3]]) all(subsets[[3]] %in% subsets[[2]]) all(subsets[[2]] %in% subsets[[1]]) I can write a little function to do this: check.for.inclusion - function(subsets){ out - rep(FALSE,length(subsets)-1) for(i in 1:(length(subsets)-1)){ out[i] - all(subsets[[i+1]] %in% subsets[[i]]) } return(all(out)) } how to do it elegantly and/or quickly? -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 __ 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] Compiled name to object
On Fri, 18 Nov 2005, Claus Atzenbeck wrote: How can I get R to change earlySessions$column to whatever was passed as string, in the above example earlySessions$seconds? In the meanwhile I received a solution: earlySessions[[column]] 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] Compiled name to object
Dear Claus You can write earlySessions[,seconds] instead of earlySessions$seconds and with that syntax you can also use: col1 - seconds earlySessions[,col1] and you will get what you are looking for. Best regards, Christoph Buser -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C13 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-44-632-4673 fax: 632-1228 http://stat.ethz.ch/~buser/ -- Claus Atzenbeck writes: Hi, I have a tricky problem with composing a name that should represent an object: I want to pass a data frame and a string that contains a column name to a function, e.g.: check(testFrame, seconds) The function should now divide the testFrame into two subsets and call a t-test on the numbers that are in the given column: check - function(frame, column) { sessionNo - c(s01, s02, s03, s04, s05, s06) earlySessions - subset(frame, frame$session %in% sessionNo) lateSessions - subset(frame, !frame$session %in% sessionNo) t.test(earlySessions$column, lateSessions$column) } How can I get R to change earlySessions$column to whatever was passed as string, in the above example earlySessions$seconds? Thanks for any hint. 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 __ 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] repeated %in%
Robin Hankin [EMAIL PROTECTED] writes: Hi I have a list of vectors, each one of which should be a subset of the previous one. How do I check that this property actually holds? Toy problem follows with a list of length 4 but my list can be any length subsets - list( l1 = 1:10 , l2 = seq(from=1,to=9,by=2), l3 = c(3,7), l4 = 3 ) I need all(subsets[[4]] %in% subsets[[3]]) all(subsets[[3]] %in% subsets[[2]]) all(subsets[[2]] %in% subsets[[1]]) I can write a little function to do this: check.for.inclusion - function(subsets){ out - rep(FALSE,length(subsets)-1) for(i in 1:(length(subsets)-1)){ out[i] - all(subsets[[i+1]] %in% subsets[[i]]) } return(all(out)) } how to do it elegantly and/or quickly? How about !any(sapply(mapply(setdiff,subsets[-1],subsets[-4]),length)) [1] TRUE -- 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] repeated %in%
Robin Hankin wrote: check.for.inclusion - function(subsets){ out - rep(FALSE,length(subsets)-1) for(i in 1:(length(subsets)-1)){ out[i] - all(subsets[[i+1]] %in% subsets[[i]]) } return(all(out)) } how to do it elegantly and/or quickly? My first thought was to rewrite that function but drop out if it didnt match. But then... Assuming the first list element is the longest, then its a one liner: check2 - function(l){ length(unique(unlist(l))) == length(l[[1]]) } - basically the set of everything in all the elements is the first element, so take unique(everything) and see if its the same size as the first element. Unless I've missed something... I'd call that elegant, it may also be quicker! Baz __ 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] repeated %in%
Whoops The code I just posted only tested if all the subsequent elements were subsets of the first, it didn't check all the sequential subsets! Too cold to think straight here today... Baz __ 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] Building S4-classes, documents
Hi Seth, Thank you very much! (and thanks to Matthias Kohl and Sean Davis) My first problems in building a minimal S4-class package are solved with the help of your hints. Especially making R CMD INSTALL before trying R CMD check was a very good idea! Matthias Hi Matthias, On 17 Nov 2005, [EMAIL PROTECTED] wrote: Hello, I have some troubles when building S4-class packages. All my (S4-)code works well (without building a package). When building a package, in the R prompt after checking S3 generic/method consistency Following error occurs: Fehler: Kann R Kode in Packet 'AddNoise' nicht laden (~Error: Can not load R code from package 'AddNoise') (and there are some warnings after the error) I don't have documentation to recommend other than what you mentioned. However, a few things to look into: 1. If you have your R code in multiple files, you may need to use the DESCRIPTION file's Collate field to control the loading order. Basically, you want: Class defintions, generics, methods, other. 2. Put methods and any other packages you depend on in Depends. 3. Add SaveImage: yes. Also, make sure R CMD INSTALL yourPackage/ works before trying R CMD check yourPackage. + seth __ 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-News 5/2, Bayesian Model Averaging, a detail
The article on BMA (Bayesian model averaging) presents most valuable tools for model selection, but I find one detail confusing in Example 1. In page 4 of RNews 5/2, second paragraph says that the probability of Time variable not being in the model is 0.445. It seems to me that the figure should be 1 - 0.445 = 0.555, because p!=0.445 is the prob. of Time variable being in the model. The plot in Fig.2 is in line with this, since the height of scaled PDF seems to be 0.445 and the black spike points to 0.555. Have I understood this correctly? Regards, Antti Pirjetä, PhD student, Helsinki School of Economics. Mail to: [EMAIL PROTECTED] Muutoksia sähköpostiosoitteissamme: @hkkk.fi-päätteiset osoitteet ovat muuttuneet muotoon @hse.fi. Opiskelijoiden (nyt @ky.hkkk.fi) osoitteen loppuosaksi muuttuu tammikuussa 2006 @student.hse.fi. Vanhoihin osoitteisiin lähetetyt viestit ohjautuvat muutoksen jälkeenkin perille. Changes in our e-mail addresses: @hkkk.fi has been replaced by @hse.fi. Students' e-mail address (@ky.hkkk.fi) will change in January 2006 to @student.hse.fi. E-mails sent to the old address will be redirected to the new one. _ [[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] R-News 5/2, Bayesian Model Averaging, a detail
The article on BMA (Bayesian model averaging) presents most valuable tools for model selection, but I find one detail confusing in Example 1. In page 4 of RNews 5/2, second paragraph says that the probability of Time variable not being in the model is 0.445. It seems to me that the figure should be 1 - 0.445 = 0.555, because p!=0.445 is the prob. of Time variable being in the model. The plot in Fig.2 is in line with this, since the height of scaled PDF seems to be 0.445 and the black spike points to 0.555. Have I understood this correctly? Regards, Antti Pirjetä, Helsinki School of Economics. Mail to: [EMAIL PROTECTED] Muutoksia sähköpostiosoitteissamme: @hkkk.fi-päätteiset osoitteet ovat muuttuneet muotoon @hse.fi. Opiskelijoiden (nyt @ky.hkkk.fi) osoitteen loppuosaksi muuttuu tammikuussa 2006 @student.hse.fi. Vanhoihin osoitteisiin lähetetyt viestit ohjautuvat muutoksen jälkeenkin perille. Changes in our e-mail addresses: @hkkk.fi has been replaced by @hse.fi. Students' e-mail address (@ky.hkkk.fi) will change in January 2006 to @student.hse.fi. E-mails sent to the old address will be redirected to the new one. __ 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] nlme questions
Spencer; Thanks for your suggestions. I found the problem is in the library nlme. If you define phi1~factor(trt1)+factor(trt2) instead of phi1~trt1+trt2 the augPred function works. A bug? I don't know. Christian Spencer Graves [EMAIL PROTECTED] on 17-11-2005 20:19:32 To:Christian Mora [EMAIL PROTECTED] cc:r-help@stat.math.ethz.ch Subject:Re: [R] nlme questions Both your questions seem too vague to me. You might get more useful replies if you provide a simple example in a few lines of R code that a reader could copy from your email into R and see the result (as suggested in the posting guide! www.R-project.org/posting-guide.html). The process of preparing such a simple example might by itself provide the insight you desire. Alternatively, you might work line by line through the code for the R function you are using. Also, if you don't have Pinheiro and Bates (2000) Mixed-Effects Models in S and S-PLUS (Springer), I suggest you get it; it is excellent for things like this. I'm sorry I couldn't help more. spencer graves Christian Mora wrote: Dear R users; Ive got two questions concerning nlme library 3.1-65 (running on R 2.2.0 / Win XP Pro). The first one is related to augPred function. Ive been working with a nonlinear mixed model with no problems so far. However, when the parameters of the model are specified in terms of some other covariates, say treatment (i.e. phi1~trt1+trt2, etc) the augPred function give me the following error: Error in predict.nlme(object, value[1:(nrow(value)/nL),,drop=FALSE], : Levels 0,1 not allowed for trt1, trt2. The same model specification as well as the augPred function under SPlus 2000 run without problems. The second question has to deal with the time needed for the model to converge. It really takes a lot of time to fit the model on R in relation to the time required to fit the same model on SPlus. I can imagine this is related to the optimization algorithm or something like that, but I would like to have a different opinion on these two issues. Thanks in advance Christian Mora __ 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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ 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] nlme questions
Warning: non-expert thoughts to follow. When passing an object to a predict method, the method looks at (a copy) of the original information from the dataframe that was used in the fit. Your original data contains information on trt1 and trt2, but factor(trt1) and factor(trt2) cannot be found in the original data. If you did the factor conversion in the original data myDat - factor(myDat$trt1) myDat - factor(myDat$trt2) then used myDat as the dataframe in the nlme call, all information would be available for the augPred method. That's why it works when you use trt1 and trt2 instead of factor(trt1) and factor(trt2). There is actually an implicit factor conversion happening in the nlme call if trt1 and trt2 are character variables, however if trt1 and trt2 are defined as numeric (ie 0 1) then it will fit as a numeric. --Matt -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Christian Mora Sent: Friday, November 18, 2005 4:01 AM To: Spencer Graves Cc: r-help@stat.math.ethz.ch Subject: Re: [R] nlme questions Spencer; Thanks for your suggestions. I found the problem is in the library nlme. If you define phi1~factor(trt1)+factor(trt2) instead of phi1~trt1+trt2 the augPred function works. A bug? I don't know. Christian Spencer Graves [EMAIL PROTECTED] on 17-11-2005 20:19:32 To:Christian Mora [EMAIL PROTECTED] cc:r-help@stat.math.ethz.ch Subject:Re: [R] nlme questions Both your questions seem too vague to me. You might get more useful replies if you provide a simple example in a few lines of R code that a reader could copy from your email into R and see the result (as suggested in the posting guide! www.R-project.org/posting-guide.html). The process of preparing such a simple example might by itself provide the insight you desire. Alternatively, you might work line by line through the code for the R function you are using. Also, if you don't have Pinheiro and Bates (2000) Mixed-Effects Models in S and S-PLUS (Springer), I suggest you get it; it is excellent for things like this. I'm sorry I couldn't help more. spencer graves Christian Mora wrote: Dear R users; Ive got two questions concerning nlme library 3.1-65 (running on R 2.2.0 / Win XP Pro). The first one is related to augPred function. Ive been working with a nonlinear mixed model with no problems so far. However, when the parameters of the model are specified in terms of some other covariates, say treatment (i.e. phi1~trt1+trt2, etc) the augPred function give me the following error: Error in predict.nlme(object, value[1:(nrow(value)/nL),,drop=FALSE], : Levels 0,1 not allowed for trt1, trt2. The same model specification as well as the augPred function under SPlus 2000 run without problems. The second question has to deal with the time needed for the model to converge. It really takes a lot of time to fit the model on R in relation to the time required to fit the same model on SPlus. I can imagine this is related to the optimization algorithm or something like that, but I would like to have a different opinion on these two issues. Thanks in advance Christian Mora __ 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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ 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] nlme questions
Yes, I agree. But if you define at the beginning of the code: data$trt1-as.factor(data$trt1) data$trt2-as.factor(data$trt2) being trt1 and trt2 dummy variables with values 0 or 1, and then run the model, for instance: fit_1-nlme(Y~b0/(1+exp((b1-X)/b2)),fixed=b0+b1+b2~trt1+trt2, random=b0+b1+b2~1,data=data,start=fixef(fit_0)) the augPred function doesn't work and return the error Error in predict.nlme(object, value[1:(nrow(value)/nL),,drop=FALSE], : Levels 0,1 not allowed for trt1, trt2 but, if you modify the code as fit_2-nlme(Y~b0/(1+exp((b1-X)/b2)),fixed=b0+b1+b2~factor(trt1)+factor(trt2), random=b0+b1+b2~1,data=data,start=fixef(fit_0)) i.e. indicating again that trt1 and trt2 are factors, even when they were previouslly defined as factors through the function as.factors, then augPred works Austin, Matt [EMAIL PROTECTED] on 18-11-2005 07:19:24 To:'Christian Mora' [EMAIL PROTECTED], Spencer Graves [EMAIL PROTECTED] cc:r-help@stat.math.ethz.ch Subject:RE: [R] nlme questions Warning: non-expert thoughts to follow. When passing an object to a predict method, the method looks at (a copy) of the original information from the dataframe that was used in the fit. Your original data contains information on trt1 and trt2, but factor(trt1) and factor(trt2) cannot be found in the original data. If you did the factor conversion in the original data myDat - factor(myDat$trt1) myDat - factor(myDat$trt2) then used myDat as the dataframe in the nlme call, all information would be available for the augPred method. That's why it works when you use trt1 and trt2 instead of factor(trt1) and factor(trt2). There is actually an implicit factor conversion happening in the nlme call if trt1 and trt2 are character variables, however if trt1 and trt2 are defined as numeric (ie 0 1) then it will fit as a numeric. --Matt -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Christian Mora Sent: Friday, November 18, 2005 4:01 AM To: Spencer Graves Cc: r-help@stat.math.ethz.ch Subject: Re: [R] nlme questions Spencer; Thanks for your suggestions. I found the problem is in the library nlme. If you define phi1~factor(trt1)+factor(trt2) instead of phi1~trt1+trt2 the augPred function works. A bug? I don't know. Christian Spencer Graves [EMAIL PROTECTED] on 17-11-2005 20:19:32 To:Christian Mora [EMAIL PROTECTED] cc:r-help@stat.math.ethz.ch Subject:Re: [R] nlme questions Both your questions seem too vague to me. You might get more useful replies if you provide a simple example in a few lines of R code that a reader could copy from your email into R and see the result (as suggested in the posting guide! www.R-project.org/posting-guide.html). The process of preparing such a simple example might by itself provide the insight you desire. Alternatively, you might work line by line through the code for the R function you are using. Also, if you don't have Pinheiro and Bates (2000) Mixed-Effects Models in S and S-PLUS (Springer), I suggest you get it; it is excellent for things like this. I'm sorry I couldn't help more. spencer graves Christian Mora wrote: Dear R users; Ive got two questions concerning nlme library 3.1-65 (running on R 2.2.0 / Win XP Pro). The first one is related to augPred function. Ive been working with a nonlinear mixed model with no problems so far. However, when the parameters of the model are specified in terms of some other covariates, say treatment (i.e. phi1~trt1+trt2, etc) the augPred function give me the following error: Error in predict.nlme(object, value[1:(nrow(value)/nL),,drop=FALSE], : Levels 0,1 not allowed for trt1, trt2. The same model specification as well as the augPred function under SPlus 2000 run without problems. The second question has to deal with the time needed for the model to converge. It really takes a lot of time to fit the model on R in relation to the time required to fit the same model on SPlus. I can imagine this is related to the optimization algorithm or something like that, but I would like to have a different opinion on these two issues. Thanks in advance Christian Mora __ 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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ 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] changing figure size in Sweave
Bjørn-Helge Mevik wrote: Or use \documentclass[nogin,...]{...}. Then the 'Gin' will have no effect, and the size of the plots in the document will not be changed from the size given as ...,height=??,width=?? (i.e. the size produced by R). A small correction: using the 'nogin' doesn't make LaTeX ignore settings of 'Gin', but prevents Sweave.sty from setting it. -- Bjørn-Helge Mevik __ 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] Fitting model with varying number of predictors
Juni Joshi wrote: I need to fit a number of models with different number of predictors in each model. Say for example, I have three predictors: x1, x2, x3 and I want to fit three models: lm(y~x1+x2) lm(y~x2+x3) lm(y~x1+x2+x3) Stepwise variable selection has so many problems that it generally ruins what you are trying to accomplish. Trying many models leads to multiple coparison problems and bias in coefficient estimates, standard errors, R-squared. With only three models being compared it's not a huge issue but in general beware. Frank Harrell Instead of typing all models, what I want is to create a variable which can take the right hand side of the models. I tried this with paste function. xxx - paste(x1,x2,sep=+) for the first xxx - paste(x2,x3, sep = +) for the second xxx - paste(x1,x2,x2, sep = +) for the third and then fit a single model lm(y~xxx) It did not work. Please suggest how to do it. Thanks. Jun -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ 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] Surprise when mapping matrix to image
Hello, I wonder if image(t(x)[ncol(x):1, ]) can do the job correct! perhaps this does the job better: image(t(x)[,nrow(x):1]) Björn From: Prof Brian Ripley ripley_at_stats.ox.ac.uk Date: Fri 27 Aug 2004 - 06:43:50 EST On Thu, 26 Aug 2004, Glynn, Earl wrote: Start with: x - c(1:7,1) dim(x) - c(2,4) x [,1] [,2] [,3] [,4] [1,] 1 3 5 7 [2,] 2 4 6 1 2 Rows of 4 Columns. Upper-left and lower-right elements of the matrix are the same. All to this point makes good sense. It's pure convention: see below. image(x) However, this image shows 2 columns of 4 rows. The lower-left and upper-right elements are the same. This does not make sense to me. Did I miss some simple parameter to fix all of this naturally? Why would the numeric matrix of x and the image of x have such a different geometry? Did you try reading the help for image? You don't seem to understand it if you actually did. It seems you are looking for image(t(x)[ncol(x):1, ]) Easy! Mathematical conventions are just that, conventions. They differ by field of mathematics. Don't ask us why matrix rows are numbered down but graphs are numbered up the y axis, nor why x comes before y but row before column. But the matrix layout has always seemed illogical to me. -- 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 Jetzt Handykosten senken mit klarmobil - 15 Ct./Min.! Hier klicken www.klarmobil.de/index.html?pid=73025 __ 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] Likely cause of error (code=1) in compar.gee/gee
Hi, I'm attempting a comparative analysis using the function compare.gee, package (ape), which uses phylogeny as a correlation matrix in gee (package gee), in R version 2.2.0 on a Windows XP PC. I'm looking to model the relationship between a continuous explanatory variable and a binary response variable for 600 species, taking into account the phylogeny of those species. Here's an example of the code used: model.rangecompar.gee(DS2$thr.vs.non.thr~DS2$log.range,family=binomial ,phy=pruned.di.tree,scale.fix=FALSE) (where DS2$thr.non.thr is a binary response variable, and DS2$log.range is a continuous explanatory variable). When I run the function, a model summary is produced, but so is following message: [1] Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27 [1] running glm to get initial regression estimate [1] 5.069447 -1.220802 Warning message: Note: Cgee had an error (code= 1 ). Results suspect. in: gee(DS2$thr.vs.non.thr ~ DS2$log.range, c(1, 1, 1, 1, 1, 1, 1, I looked into code of compare.gee and gee (which is called in compare.gee), and it appears that the error state is an Unknown error. I wondered if anyone has experienced similar problems, or may be aware of the most likely reasons for this error message. If more info is required in order to give any advice, please let me know and I can forward you details of the dataset or the tree used in the analysis Many thanks for any help that can be offered. Cheers, Jon. http://www.zoo.cam.ac.uk/ioz/people/bielby.htm [[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] Method for $
Dear R experts, I have defined a class myclass and would like the slots to be extractable not only by @ but also by $. I now try to write a method for $ that simply executes the request [EMAIL PROTECTED], whenever someone calls object$slotname for any object of class myclass. I don't manage to find out how I can provide this function with slotname, so that one and the same function works for any arbitrary slotname a user might choose. I have tried setMethod($, signature(x=myclass), function(x,slotname){ [EMAIL PROTECTED] } ) This produced the error message: In method for function $: expanding the signature to include omitted arguments in definition: name = missing Error in rematchDefinition(definition, fdef, mnames, fnames, signature) : methods can add arguments to the generic only if '...' is an argument to the generic My searches for a solution of this problem have not been successful. Can someone help? Thanks and regards, Ulrike Grömping, Berlin __ 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] Image display in R
Hi all, I am trying to display a matrix of plots(images), for example a 3*3 matrix of 9 image plots, such that when a user clicks on a image i can show the enlarged plot. I tried the multiple graphic device(using mfcol=c(3,3) and mfg), but it creates multiple plots in a single image file. So, i won't be able to highlight a particular plot when the user clicks on it. To be more clear, can i display images in the form of a matrix in R. Are there any grids available? Please let me know. Thanks, Vasu. [[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] about eval and eval.parent
x-1 f-function(){ x-3 eval(substitute(x+y,list(y=10))) } f() #13 x-1 f-function(){ x-3 eval(substitute(x+y,list(y=10)), envir = sys.frame(sys.parent())) } f() #11 x-1 f-function(){ x-3 eval.parent(substitute(x+y,list(y=10))) } f()#11 the help page says: If 'envir' is not specified, then 'sys.frame(sys.parent())', the environment where the call to 'eval' was made is used. But it seems that the first one is not equal to the second one. Thank you! 2005-11-18 -- Deparment of Sociology Fudan University My new mail addres is [EMAIL PROTECTED] Blog:http://sociology.yculblog.com __ 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 eval and eval.parent
On Fri, 18 Nov 2005, ronggui wrote: x-1 f-function(){ x-3 eval(substitute(x+y,list(y=10))) } f() #13 x-1 f-function(){ x-3 eval(substitute(x+y,list(y=10)), envir = sys.frame(sys.parent())) } f() #11 x-1 f-function(){ x-3 eval.parent(substitute(x+y,list(y=10))) } f()#11 the help page says: If 'envir' is not specified, then 'sys.frame(sys.parent())', the environment where the call to 'eval' was made is used. But it seems that the first one is not equal to the second one. No, it isn't. This is because default arguments are evaluated inside the function but explicit argumnets are evaluated in the calling frame In the first one, sys.frame(sys.parent()) is evaluated in the environment inside f(), and so refers to the frame from which f() was called. That's what you would expect from pass-by-value In the second one, sys.frame(sys.parent()) is evaluated inside substitute() and refers to the environment inside f(). That might be surprising, which is why it is documented. -thomas __ 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 run R in batch mode
Hello to everybody! I want to run R in batch mode but it doen't work (Error: syntax error) I've found this in R help: R CMD BATCH [options] infile [outfile] I have tried differents commands: (I have been working in the same directory I have test.txt file and test2.txt would be the output file) R CMD BATCH test.txt or R CMD BATCH test.txt or BATCH test.txt or R CMD BATCH test.txt test2.txt or R CMD BATCH test.txt test2.txt or R CMD BATCH --no-save test.txt I don't know what is wrong. Could you help me, please? Thanks a lot __ 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 run R in batch mode
On Fri, 18 Nov 2005, Beatriz wrote: I want to run R in batch mode but it doen't work (Error: syntax error) I've found this in R help: R CMD BATCH [options] infile [outfile] I have tried differents commands: (I have been working in the same directory I have test.txt file and test2.txt would be the output file) R CMD BATCH test.txt [SNIP additional tries] I don't know what is wrong. Could you help me, please? Isn't it possible that it is working just fine and you really do have a syntax error in your R source file (better named as 'test.R') instead? -- SIGSIG -- signature too long (core dumped) __ 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] Image display in R
This peice of very useful getcell() function was posted for me on this list by Duncan Murdoch (Thanks again Duncan). It allows the identification of a particular plot in a matrix of plots. All you need to do then is use this information to identify the original plot which you can then re-plot. ## Start Function ## getcell - function(pts = locator()) { usr - par(usr) plt - par(plt) mfg - par(mfg) x - pts$x y - pts$y # convert to 0-1 plot coordinates px - (x-usr[1])/(usr[2]-usr[1]) py - (y-usr[3])/(usr[4]-usr[3]) # convert to 0-1 frame coordinates fx - plt[1] + px*(plt[2]-plt[1]) fy - plt[3] + py*(plt[4]-plt[3]) # convert to a relative cell position cx - floor(fx) cy - floor(fy) # return the absolute cell position list(row = -cy+mfg[1],col = cx+mfg[2]) } ### End Function ### #For example Dset1-1:10 Dset2-rnorm(10) oldpar-par(mfrow=c(2,1)) plot(Dset1) plot(Dset2) cell-getcell(locator(1)) if((cell$row*cell$col)2){ par(mfrow=c(1,1)) plot(Dset1) } else { par(mfrow=c(1,1)) plot(Dset2) } I hope this gives you something to work with. Tom On Fri, 2005-18-11 at 09:46 -0500, Vasundhara Akkineni wrote: Hi all, I am trying to display a matrix of plots(images), for example a 3*3 matrix of 9 image plots, such that when a user clicks on a image i can show the enlarged plot. I tried the multiple graphic device(using mfcol=c(3,3) and mfg), but it creates multiple plots in a single image file. So, i won't be able to highlight a particular plot when the user clicks on it. To be more clear, can i display images in the form of a matrix in R. Are there any grids available? Please let me know. Thanks, Vasu. [[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] How to run R in batch mode
On 11/18/2005 10:20 AM, Beatriz wrote: Hello to everybody! I want to run R in batch mode but it doen't work (Error: syntax error) I've found this in R help: R CMD BATCH [options] infile [outfile] I have tried differents commands: (I have been working in the same directory I have test.txt file and test2.txt would be the output file) R CMD BATCH test.txt Where did you type that? It looks like you typed it within R. That's a shell command, and needs to be typed in a shell. However, I can't be sure about this, because you're not showing us what happened when you tried it. Please, please, please: if you need help with an error, show us the exact error message and tell us the context where you received it. 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] about eval and eval.parent
On Fri, 18 Nov 2005, ronggui wrote: x-1 f-function(){ x-3 eval(substitute(x+y,list(y=10))) } f() #13 x-1 f-function(){ x-3 eval(substitute(x+y,list(y=10)), envir = sys.frame(sys.parent())) } f() #11 x-1 f-function(){ x-3 eval.parent(substitute(x+y,list(y=10))) } f()#11 the help page says: If 'envir' is not specified, then 'sys.frame(sys.parent())', the environment where the call to 'eval' was made is used. But it seems that the first one is not equal to the second one. I think you have plucked this out of context. It is the default value for envir which is parent.frame() (and was sys.frame(sys.parent()), the same thing). Default and explicit arguments are not evaluated in the same frames, and so giving sys.frame(sys.parent()) as an explicit argument is different from taking the default. Once you remember the last sentence, there is no mystery. -- 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] How to run R in batch mode
I've only wirtten library(limma) in my test.txt file and I've tried with test.R and test.r too I' don't know the problem Thank you Paul Roebuck wrote: On Fri, 18 Nov 2005, Beatriz wrote: I want to run R in batch mode but it doen't work (Error: syntax error) I've found this in R help: R CMD BATCH [options] infile [outfile] I have tried differents commands: (I have been working in the same directory I have test.txt file and test2.txt would be the output file) R CMD BATCH test.txt [SNIP additional tries] I don't know what is wrong. Could you help me, please? Isn't it possible that it is working just fine and you really do have a syntax error in your R source file (better named as 'test.R') instead? -- SIGSIG -- signature too long (core dumped) __ 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] Problems with tkentry
Hello to all, I don't know almost nothing about Tcl/TK. I have the follow code: Name - tclVar() insert.Name -tkentry(window1,width=20,objectvariable=Name) tkplace(tklabel(window1,text= Enter the matrix name:),x=0,y=0) tkplace(insert.Name,x=175,y=0) So, I need to pass the variable Name like parameter in R function. Ex: print(Name) iris[,1:4] dist(Name) NAs introduced by coercion This problems happen because the type of Name is character. I try the function get(), but nothing. -- Marcelo Damasceno de Melo Graduando em Ciência da Computação Departamento de Tecnologia da Informação - TCI Universidade Federal de Alagoas - UFAL Maceió - Alagoas - Brasil Projeto CoCADa - Construção do Conhecimento por Agrupamento de dados +55 82 8801-2119 [[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 run R in batch mode
On Fri, 18 Nov 2005, Beatriz wrote: Paul Roebuck wrote: On Fri, 18 Nov 2005, Beatriz wrote: I want to run R in batch mode but it doen't work (Error: syntax error) [SNIP] I don't know what is wrong. Could you help me, please? Isn't it possible that it is working just fine and you really do have a syntax error in your R source file (better named as 'test.R') instead? I've only wirtten library(limma) in my test.txt file and I've tried with test.R and test.r too Try the following: $ cat hello.R cat(hello, world, \n) Ctrl-D $ R CMD BATCH hello.R hello.Rout $ cat hello.Rout -- SIGSIG -- signature too long (core dumped) __ 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] Calculation of the median in survfit()
Dear R users, Can anyone tell me how the medians in survfit() are computed? I´ve looked it up in the source code (print.survfit.s version 4.19 07/09/00), but I´m not a programmer...;-) Especially, I´d like to know what the pfun() function inside print.survfit.s() works. The help file does describe the calculation of the median, but I´d like to know if and how this differs from just directly calculating the median of the survival times (e.g. using tapply(time,factor,median)). I would be most grateful for any help. Thanks a lot! Christoph ### [I am using R 2.1.1 on WinXP with the latest version of the survival package] __ 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] Method for $
Ulrike Grömping wrote: Dear R experts, I have defined a class myclass and would like the slots to be extractable not only by @ but also by $. I now try to write a method for $ that simply executes the request [EMAIL PROTECTED], whenever someone calls object$slotname for any object of class myclass. I don't manage to find out how I can provide this function with slotname, so that one and the same function works for any arbitrary slotname a user might choose. I have tried setMethod($, signature(x=myclass), function(x,slotname){ [EMAIL PROTECTED] } ) Ulrike, what about (untested!): slot(x, slotname) Best wishes from Dortmund and Lena, Uwe Ligges This produced the error message: In method for function $: expanding the signature to include omitted arguments in definition: name = missing Error in rematchDefinition(definition, fdef, mnames, fnames, signature) : methods can add arguments to the generic only if '...' is an argument to the generic My searches for a solution of this problem have not been successful. Can someone help? Thanks and regards, Ulrike Grömping, Berlin __ 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] (no subject)
Hi, I need to run a Fisher's exact test on thousands of 2x2 contingency tables, and repeat this process several thousand times (this is a part of the permutation test for a genome-wide association study). How can I run this process most efficiently? Is there any way to optimize R code? I have my data in a 2x2xN array (N ~ 5 K; eventually N will be ~ 500 K), and use apply inside the loop: for (iter in 1:1000) { apply(data,3,fisherPval) } fisherPval - function(x) { fisher.test(x)$p.value } Right now, it takes about 30 sec per iteration on an Intel Xeon 3.06GHz processor. Thanks in advance. -- Anna Pluzhnikov, PhD Section of Genetic Medicine Department of Medicine The University of Chicago - This email is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged and confidential. If the reader of this email message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is prohibited. If you have received this email in error, please notify the sender and destroy/delete all copies of the transmittal. Thank you. __ 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] truncated observations in survreg
Dear R-list I have been trying to make survreg fit a normal regression model with left truncated data, but unfortunately I am not able to figure out how to do it. The following survreg-call seems to work just fine when the observations are right censored: library(survival) n-10 #censored observations x-rnorm(n) y-rnorm(n,mean=x) d-data.frame(x,y) d$ym-pmin(y,0.5) d$c-ifelse(d$ym==0.5,0,1) s-survreg(Surv(ym,c)~x, dist=gaussian,data=d) The truncated observations can be fitted with the following naive code. Being able to use survreg (or similar) would however be great. #trucated observations d$c-0.1 e-d[d$yd$c,] e$cc-1 #ss-survreg(Surv(time=c,time2 =y,event=cc,type=right)~x, dist=gaussian,data=e) a-function(x,y,alpha=0,beta=1,sigma=1,s) { sum( log((dnorm(y,mean=alpha+beta*x,sd=sigma^2)/(1-pnorm(q=s,mean=alpha+beta*x,sd=sigma^2 ) } ll-function(x,y,alpha=0,beta=1,sigma=1,s) { aa-function(z){a(z[1],z[2],alpha=alpha,beta=beta,sigma=sigma,s=s)} v-apply(cbind(x,y),1,aa) sum(v) } logl-function(pars) { -a(x=e$x,y=e$y,alpha=pars[1],beta=pars[2],sigma=pars[3],s=0.1) } ss-optim(c(0,0,1),logl) print(s) print(ss) Thx for any help Per Jensen [[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 run R in batch mode
On 11/18/2005 11:25 AM, Beatriz wrote: I write R CMD BATCH test.R in my R console I have send you an image (RunBatch.jpg) of my console and the test.R file I don't think the jpg made it to R-help, but I saw it. You tried to run R CMD BATCH test.R from within R. That's meant to be a system command. Since you're running in Windows, you should open a command shell. One way to do that is to choose Run... from the Start Menu, and enter cmd. You'll get a black command shell window. If your path is set properly so that you can run R from there, then R CMD BATCH test.R should work. There is a way to do this from within R: run system(R CMD BATCH test.R,intern=TRUE) This still depends on your path being set correctly to find R. 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] Millions of calls to fisher.test (was (no subject))
Setting conf.int=FALSE will help. Looking at the code of fisher.test and extracting just the bit you need will help more. Do you actually need a two-sided test? Fisher did not, and if not, the computations can be reduced to a call to phyper which is vectorized. On Fri, 18 Nov 2005, Anna Pluzhnikov wrote: Hi, I need to run a Fisher's exact test on thousands of 2x2 contingency tables, and repeat this process several thousand times (this is a part of the permutation test for a genome-wide association study). How can I run this process most efficiently? Is there any way to optimize R code? I have my data in a 2x2xN array (N ~ 5 K; eventually N will be ~ 500 K), and use apply inside the loop: for (iter in 1:1000) { apply(data,3,fisherPval) } Why are you calling the same thing 1000 times? fisherPval - function(x) { fisher.test(x)$p.value } Right now, it takes about 30 sec per iteration on an Intel Xeon 3.06GHz processor. [Disclaimer etc removed] PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html PLEASE do, and use a meaningful subject line. -- 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] Method for $
Ulrike == Ulrike Grömping [EMAIL PROTECTED] on Fri, 18 Nov 2005 15:37:58 +0100 writes: Ulrike Dear R experts, Ulrike I have defined a class myclass and would like the Ulrike slots to be extractable not only by @ but also by $. hmm, I know this is not what you've asked for, but why would you want to do that? To me, it seems a pretty harmful idea that only leads to confusion and does not provide sensible functionality. When S4 classes where created, using '@' instead of '@' with a *different* meaning was very much on purpose and I think it's a bit too ambitious to try being smarter than John Chambers, the creator of the S4 object system, on this. Martin Maechler, ETH Zurich Ulrike I now try to write a method for $ that Ulrike simply executes the request [EMAIL PROTECTED], whenever someone calls Ulrike object$slotname for any object of class myclass. Ulrike .. Ulrike .. __ 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] (no subject)
Anna Pluzhnikov [EMAIL PROTECTED] writes: Hi, I need to run a Fisher's exact test on thousands of 2x2 contingency tables, and repeat this process several thousand times (this is a part of the permutation test for a genome-wide association study). How can I run this process most efficiently? Is there any way to optimize R code? I have my data in a 2x2xN array (N ~ 5 K; eventually N will be ~ 500 K), and use apply inside the loop: for (iter in 1:1000) { apply(data,3,fisherPval) } fisherPval - function(x) { fisher.test(x)$p.value } Right now, it takes about 30 sec per iteration on an Intel Xeon 3.06GHz processor. Thanks in advance. The appropriate application of phyper() should save you quite a bit, especially if you're pragmatic and just use the two one-sided tests rather than the two-sided one which is a bit harder to compute. (Notice that phyper() is vectorized over all its arguments). As in: M - array(rpois(2*2*5000,lambda=20),c(2,2,50)) x - M[1,1,] m - M[1,1,]+M[2,1,] n - M[1,2,]+M[2,2,] k - M[1,1,]+M[1,2,] system.time(pleft-phyper(x,m,n,k)) [1] 2.16 0.01 2.16 0.00 0.00 sum(pleft 0.05) [1] 16400 sum(pleft 0.05)/50 [1] 0.0328 -- 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] Method for $
Uwe, thank thank you very much for your suggestion. This does in fact work, if I define $.myclass-function(x,slotname){slot(x,slotname)} which solves my immediate need. However, the setMethod version setMethod($, signature(x=myclass), function(x,slotname){ slot(x,slotname) } ) still produces the same error message as before (cf. below). If anyone has a solution for this, I would appreciate it. Uwe, my best wishes also to Dortmund and Lena, and by the way, it's your book that got me started with understanding (part of) the programming aspects of R relatively fast. Regards, Ulrike Grömping -- Original Message --- From: Uwe Ligges [EMAIL PROTECTED] To: Ulrike Grömping [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Fri, 18 Nov 2005 17:45:40 +0100 Subject: Re: [R] Method for $ Ulrike Grömping wrote: Dear R experts, I have defined a class myclass and would like the slots to be extractable not only by @ but also by $. I now try to write a method for $ that simply executes the request [EMAIL PROTECTED], whenever someone calls object$slotname for any object of class myclass. I don't manage to find out how I can provide this function with slotname, so that one and the same function works for any arbitrary slotname a user might choose. I have tried setMethod($, signature(x=myclass), function(x,slotname){ [EMAIL PROTECTED] } ) Ulrike, what about (untested!): slot(x, slotname) Best wishes from Dortmund and Lena, Uwe Ligges This produced the error message: In method for function $: expanding the signature to include omitted arguments in definition: name = missing Error in rematchDefinition(definition, fdef, mnames, fnames, signature) : methods can add arguments to the generic only if '...' is an argument to the generic My searches for a solution of this problem have not been successful. Can someone help? Thanks and regards, Ulrike Grömping, Berlin __ 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 --- End of Original Message --- __ 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] Method for $
I believe that a recommended S4 convention is simply to write methods for slot extraction with the same name as the slot. Thus, for an object,x of class 'myclass' slotname(x) would give [EMAIL PROTECTED] This is a more natural interface than either @ or $ (and I am not sure that methods for $ can be defined due to S3/S4 class consistency details). Obviously, it is trivial, but a bit tedious, to manually write such methods for any class you care to. However, I wrote a small generator function that automatically generates the slot extraction methods for any class if you wish to do things this way. I just run this right after I've define a new class,'myclass', to generate slot access methods by: slotget('myclass') The code is below. I would appreciate feedback on any errors or suggestions for improvement. Cheers, -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA slotGet-function(x,where=topenv()) #automatically generates accessor and replacement methods for class x { if(!isClass(x,where=where))stop(paste('Class',x,'not found')) slots-slotNames(getClass(x,where=where)) for(slt in slots){ ## slot accessor fun-function(object)NULL if(!isGeneric(slt,where=where)){ if(exists(slt,where=where,mode=function)) fun-get(slt,pos=where,mode=function) else body(fun)-substitute(standardGeneric(slt)) setGeneric(slt,fun,where=where) } if(!existsMethod(slt,x,where=where)){ body(fun)-substitute([EMAIL PROTECTED]) setMethod(slt,x,fun,where=where) } } invisible() } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Uwe Ligges Sent: Friday, November 18, 2005 8:46 AM To: Ulrike Grömping Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Method for $ Ulrike Grömping wrote: Dear R experts, I have defined a class myclass and would like the slots to be extractable not only by @ but also by $. I now try to write a method for $ that simply executes the request [EMAIL PROTECTED], whenever someone calls object$slotname for any object of class myclass. I don't manage to find out how I can provide this function with slotname, so that one and the same function works for any arbitrary slotname a user might choose. I have tried setMethod($, signature(x=myclass), function(x,slotname){ [EMAIL PROTECTED] } ) Ulrike, what about (untested!): slot(x, slotname) Best wishes from Dortmund and Lena, Uwe Ligges This produced the error message: In method for function $: expanding the signature to include omitted arguments in definition: name = missing Error in rematchDefinition(definition, fdef, mnames, fnames, signature) : methods can add arguments to the generic only if '...' is an argument to the generic My searches for a solution of this problem have not been successful. Can someone help? Thanks and regards, Ulrike Grömping, Berlin __ 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-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] Method for $
I have had that thought myself as well, but don't see any harm in my particular application. I describe in general terms what I'm trying to do: I have defined a class for the output of a function that does various calculations. The reason for this is that I want methods for plotting and printing for the output object. On the other hand, the output object does include various sub-objects the access of which is useful for users (basically, the object was a list of several vectors and numbers, before I decided that I need a class, and in the class definition, I have defined the elements of the list as slots). Maybe I could (and should?) have defined the class with just one slot that contains the list, which would make it behave like I want it immediately. Regards, Ulrike Grömping -- Original Message --- From: Martin Maechler [EMAIL PROTECTED] To: Ulrike Grömping [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Fri, 18 Nov 2005 18:29:27 +0100 Subject: Re: [R] Method for $ Ulrike == Ulrike Grömping [EMAIL PROTECTED] on Fri, 18 Nov 2005 15:37:58 +0100 writes: Ulrike Dear R experts, Ulrike I have defined a class myclass and would like the Ulrike slots to be extractable not only by @ but also by $. hmm, I know this is not what you've asked for, but why would you want to do that? To me, it seems a pretty harmful idea that only leads to confusion and does not provide sensible functionality. When S4 classes where created, using '@' instead of '@' with a *different* meaning was very much on purpose and I think it's a bit too ambitious to try being smarter than John Chambers, the creator of the S4 object system, on this. Martin Maechler, ETH Zurich Ulrike I now try to write a method for $ that Ulrike simply executes the request [EMAIL PROTECTED], whenever someone calls Ulrike object$slotname for any object of class myclass. Ulrike .. Ulrike .. --- End of Original Message --- [[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] Goodness fit test HELP!
What about trying a qqplot to see how the distribution fits... For the normal distribution thta is very stright forward, use qqnorm. To test gamma distribtution (or any other) do some thing like this n-length(data) for(i in 1:n){ prob-(i-1/3)/(n1/3) } quantiles-qgamma(prob,shape=mean(data)/var(data),scale=var(data)/mean(data)} qqplot(data,quantiles) If the distribution is a good for, you should a stright line, like wiht a qqnorm plot! Good luck!! Elizbaeth Lawson David Zhao [EMAIL PROTECTED] wrote: Hi there, I'm a newbie, plesae bear with me. I have a dataset with about 1 ~ 3 data points. Would like fit to both Gamma and Normal distribution to see which one fits better. How do I do this in R? Or I could do a normality test of the data, if it's normal, I then will do a normal fit, otherwise, a gamma fit. But again, I don't know how to do this either. Please help! David [[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 - [[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] Method for $
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ulrike Grömping wrote: Uwe, thank thank you very much for your suggestion. This does in fact work, if I define $.myclass-function(x,slotname){slot(x,slotname)} which solves my immediate need. However, the setMethod version setMethod($, signature(x=myclass), function(x,slotname){ slot(x,slotname) } ) still produces the same error message as before (cf. below). If anyone has a solution for this, I would appreciate it. For the record, the problem you are experiencing is that you are not using the same argument names in your method as the function $ uses. Hence there is a mismatch. Use setMethod($, signature(x=myclass), function(x, name){ slot(x, name) } ) i.e. rather than slotname as the second argument, use name as that is what $ uses. But, as Martin pointed out, this is not an advisable thing to do. And if you want to use an S4 class to house sub-elements, either explicitly specify their types with setClass('myclass', representation( a = integer, b = matrix, ) or if you want them to be arbitary objects, then think about why you are using S4. Uwe, my best wishes also to Dortmund and Lena, and by the way, it's your book that got me started with understanding (part of) the programming aspects of R relatively fast. Regards, Ulrike Grömping -- Original Message --- From: Uwe Ligges [EMAIL PROTECTED] To: Ulrike Grömping [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Fri, 18 Nov 2005 17:45:40 +0100 Subject: Re: [R] Method for $ Ulrike Grömping wrote: Dear R experts, I have defined a class myclass and would like the slots to be extractable not only by @ but also by $. I now try to write a method for $ that simply executes the request [EMAIL PROTECTED], whenever someone calls object$slotname for any object of class myclass. I don't manage to find out how I can provide this function with slotname, so that one and the same function works for any arbitrary slotname a user might choose. I have tried setMethod($, signature(x=myclass), function(x,slotname){ [EMAIL PROTECTED] } ) Ulrike, what about (untested!): slot(x, slotname) Best wishes from Dortmund and Lena, Uwe Ligges This produced the error message: In method for function $: expanding the signature to include omitted arguments in definition: name = missing Error in rematchDefinition(definition, fdef, mnames, fnames, signature) : methods can add arguments to the generic only if '...' is an argument to the generic My searches for a solution of this problem have not been successful. Can someone help? Thanks and regards, Ulrike Grömping, Berlin __ 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 --- End of Original Message --- __ 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 - -- Duncan Temple Lang[EMAIL PROTECTED] Department of Statistics work: (530) 752-4782 371 Kerr Hall fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDfhzr9p/Jzwa2QP4RAnoPAKCAeNsDpbAC52kfJnmaBdLeGPUTgwCfTqBF Ffg0eMA//XcfzY3kjBqGJ8c= =iO7y -END PGP SIGNATURE- __ 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] SWeave - can I see output in the source?
I'm working on a Latex document with lots of R code in it, so naturally enough it would be a good idea to use SWeave. But then I don't get to see the output as I'm editing. Or do I? Is there a tool to process a .Rnw file and incorporate the output from the commands into it (in a form that is not used for producing the output .tex file, but which is updated each time I process the file)? 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] Method for $
-- Original Message --- From: Duncan Temple Lang [EMAIL PROTECTED] To: Ulrike Grömping [EMAIL PROTECTED] Cc: Uwe Ligges [EMAIL PROTECTED], r-help@stat.math.ethz.ch Sent: Fri, 18 Nov 2005 10:26:51 -0800 Subject: Re: [R] Method for $ -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ulrike Grömping wrote: Uwe, thank thank you very much for your suggestion. This does in fact work, if I define $.myclass-function(x,slotname){slot(x,slotname)} which solves my immediate need. However, the setMethod version setMethod($, signature(x=myclass), function(x,slotname){ slot(x,slotname) } ) still produces the same error message as before (cf. below). If anyone has a solution for this, I would appreciate it. For the record, the problem you are experiencing is that you are not using the same argument names in your method as the function $ uses. Hence there is a mismatch. Use setMethod($, signature(x=myclass), function(x, name){ slot(x, name) } ) i.e. rather than slotname as the second argument, use name as that is what $ uses. Thanks very much for clarifying that. I just wasn't aware of the argument names of $. It's obvious from the help file, once you know what to look for, but ... But, as Martin pointed out, this is not an advisable thing to do. And if you want to use an S4 class to house sub-elements, either explicitly specify their types with setClass('myclass', representation( a = integer, b = matrix, ) or if you want them to be arbitary objects, then think about why you are using S4. I have in fact used a class definition like the one you suggest, i.e. have switched from a list to a class by defining an object type for each of my list elements. As a consequence, the former list elements were no longer accessible via $, which is what I want to recover. Uwe, my best wishes also to Dortmund and Lena, and by the way, it's your book that got me started with understanding (part of) the programming aspects of R relatively fast. Regards, Ulrike Grömping -- Original Message --- From: Uwe Ligges [EMAIL PROTECTED] To: Ulrike Grömping [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Fri, 18 Nov 2005 17:45:40 +0100 Subject: Re: [R] Method for $ Ulrike Grömping wrote: Dear R experts, I have defined a class myclass and would like the slots to be extractable not only by @ but also by $. I now try to write a method for $ that simply executes the request [EMAIL PROTECTED], whenever someone calls object$slotname for any object of class myclass. I don't manage to find out how I can provide this function with slotname, so that one and the same function works for any arbitrary slotname a user might choose. I have tried setMethod($, signature(x=myclass), function(x,slotname){ [EMAIL PROTECTED] } ) Ulrike, what about (untested!): slot(x, slotname) Best wishes from Dortmund and Lena, Uwe Ligges This produced the error message: In method for function $: expanding the signature to include omitted arguments in definition: name = missing Error in rematchDefinition(definition, fdef, mnames, fnames, signature) : methods can add arguments to the generic only if '...' is an argument to the generic My searches for a solution of this problem have not been successful. Can someone help? Thanks and regards, Ulrike Grömping, Berlin __ 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 --- End of Original Message --- __ 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 - -- Duncan Temple Lang [EMAIL PROTECTED] Department of Statistics work: (530) 752-4782 371 Kerr Hall fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDfhzr9p/Jzwa2QP4RAnoPAKCAeNsDpbAC52kfJnmaBdLeGPUTgwCfTqBF Ffg0eMA//XcfzY3kjBqGJ8c= =iO7y -END PGP SIGNATURE- --- End of Original Message --- [[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] Method for $
Berton, thanks for your code, it does work on my problem. However, I do want the $ do work the extraction, and it does if I do it right (see answer from Duncan Temple Lang). Regards, Ulrike -- Original Message --- From: Berton Gunter [EMAIL PROTECTED] To: 'Uwe Ligges' [EMAIL PROTECTED], 'Ulrike Grömping' [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Fri, 18 Nov 2005 09:42:12 -0800 Subject: RE: [R] Method for $ I believe that a recommended S4 convention is simply to write methods for slot extraction with the same name as the slot. Thus, for an object,x of class 'myclass' slotname(x) would give [EMAIL PROTECTED] This is a more natural interface than either @ or $ (and I am not sure that methods for $ can be defined due to S3/S4 class consistency details). Obviously, it is trivial, but a bit tedious, to manually write such methods for any class you care to. However, I wrote a small generator function that automatically generates the slot extraction methods for any class if you wish to do things this way. I just run this right after I've define a new class,'myclass', to generate slot access methods by: slotget('myclass') The code is below. I would appreciate feedback on any errors or suggestions for improvement. Cheers, -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA slotGet-function(x,where=topenv()) #automatically generates accessor and replacement methods for class x { if(!isClass(x,where=where))stop(paste('Class',x,'not found')) slots-slotNames(getClass(x,where=where)) for(slt in slots){ ## slot accessor fun-function(object)NULL if(!isGeneric(slt,where=where)){ if(exists(slt,where=where,mode=function)) fun-get(slt,pos=where,mode=function) else body(fun)-substitute(standardGeneric(slt)) setGeneric(slt,fun,where=where) } if(!existsMethod(slt,x,where=where)){ body(fun)-substitute([EMAIL PROTECTED]) setMethod(slt,x,fun,where=where) } } invisible() } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Uwe Ligges Sent: Friday, November 18, 2005 8:46 AM To: Ulrike Grömping Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Method for $ Ulrike Grömping wrote: Dear R experts, I have defined a class myclass and would like the slots to be extractable not only by @ but also by $. I now try to write a method for $ that simply executes the request [EMAIL PROTECTED], whenever someone calls object$slotname for any object of class myclass. I don't manage to find out how I can provide this function with slotname, so that one and the same function works for any arbitrary slotname a user might choose. I have tried setMethod($, signature(x=myclass), function(x,slotname){ [EMAIL PROTECTED] } ) Ulrike, what about (untested!): slot(x, slotname) Best wishes from Dortmund and Lena, Uwe Ligges This produced the error message: In method for function $: expanding the signature to include omitted arguments in definition: name = missing Error in rematchDefinition(definition, fdef, mnames, fnames, signature) : methods can add arguments to the generic only if '...' is an argument to the generic My searches for a solution of this problem have not been successful. Can someone help? Thanks and regards, Ulrike Grömping, Berlin __ 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 --- End of Original Message --- __ 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] truncated regression in survreg
Sorry, trying to change the unicode. Dear R-list I have been trying to make survreg fit a normal regression model with left truncated data, but unfortunately I am not able to figure out how to do it. The following survreg-call seems to work just fine when the observations are right censored: library(survival) n-10 #censored observations x-rnorm(n) y-rnorm(n,mean=x) d-data.frame(x,y) d$ym-pmin(y,0.5) d$c-ifelse(d$ym==0.5,0,1) s-survreg(Surv(ym,c)~x, dist=gaussian,data=d) The truncated observations can be fitted with the following naive code. Being able to use survreg (or similar) would however be great. #trucated observations d$c-0.1 e-d[d$yd$c,] e$cc-1 #ss-survreg(Surv(time=c,time2 =y,event=cc,type=right)~x, dist=gaussian,data=e) a-function(x,y,alpha=0,beta=1 ,sigma=1,s) { sum( log((dnorm(y,mean=alpha+beta*x,sd=sigma^2)/(1-pnorm(q=s,mean=alpha+beta*x,sd=sigma^2 ) } ll-function(x,y,alpha=0,beta=1,sigma=1,s) { aa-function(z){a(z[1],z[2],alpha=alpha,beta=beta,sigma=sigma,s=s)} v-apply(cbind(x,y),1,aa) sum(v) } logl-function(pars) { -a(x=e$x,y=e$y,alpha=pars[1],beta=pars[2],sigma=pars[3],s=0.1) } ss-optim(c(0,0,1),logl) print(s) print(ss) Thx for any help Per Jensen [[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] Adding points to wireframe
Hi, I am using function wireframe from package lattice to draw a 3D surface. I would like to add a few points on the surface. I read in a post from Deepayan Sarkar that To do this in a wireframe plot you would probably use the panel function panel.3dscatter. Does someone have an example? When calling panel.3dscatter with only x, y and z arguments I get argument xlim.scaled is missing, with no default. I do not know what value I should give to xlim.scaled. Ragards, Pierre-Luc __ 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 plot two dataset in one fig?
Hi all, I am new in R tool. I would like to plot two dataset in in fig. Here is what I did for both a and b data sets jpeg(file=a.jpeg) dat-read.table('a', header=F, sep=',') dim(dat) y-dat[,1] y-y[!is.na(y)] plot(y);lines(lowess(y, f=0.05), col = (red), lwd=5) dev.off Two questions: 1. How I can save this lowess smooth data? 2. Once I have the smooth a and b data, How I can put two smooth data sets in one fig even they have different Y ranger value? Any input will be greatly appreciated. Lucy __ 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] Point pattern to grid
Hi Roger, Thanks again for your kind help. Yes, I still use the 200K points data applying this program but the good thing is I found it finished in no time. The questions again here are: 1) try0 - lapply(split(as(df1, data.frame), res), mean) When I tried to replace mean to sum, error looks like this: Error in [EMAIL PROTECTED], i, drop = FALSE] : undefined columns selected 2) If I just need to know the number of points in each cells, how can I modify the codes. The codes still a bit beyond me. Thanks! Leaf === At 2005-11-18, 01:39:05 you wrote: === On Thu, 17 Nov 2005, Leaf Sun wrote: Dear all, I'd like to change a point pattern to a grid of cells and use one of the variables as the output. e.g. The point pattern is of a window of (500*500) and several features such as pH, SoilType etc. I like to divide it into a grid with cell size 5*5, and use the mean of the point values falling inside the cell as the output. Is there any package in R working with this? Thanks in advance! This might have been better posted on R-sig-geo. Try this: library(sp) df1 - data.frame(x=runif(1,0,500), y=runif(1,0,500), z=rnorm(1)) coordinates(df1) - c(x, y) summary(df1) # SpatialPointsDataFrame grd - GridTopology(c(2.5,2.5), c(5,5), c(100,100)) sgrd - SpatialGrid(grd) #SpatialGrid bbox(sgrd) res - overlay(sgrd, df1) # find which grid cells the points are in str(res) try0 - lapply(split(as(df1, data.frame), res), mean) # take means by grid cell - assumes all numeric columns in df1 # (soil type??) - maybe write a custom function to handle non-numeric # columns sensibly try01 - vector(mode=list, length=prod(slot(slot(sgrd, grid), cells.dim))) nafill - rep(as.numeric(NA), ncol(as(df1, data.frame))) try01 - lapply(try01, function(x) nafill) # make a container to put the means in with the right number of columns try01[as.integer(names(try0))] - try0 # insert means into correct list elements try1 - data.frame(t(data.frame(try01))) # transpose summary(try1) sgrd1 - SpatialGridDataFrame(slot(sgrd, grid), try1) image(sgrd1, x) image(sgrd1, y) image(sgrd1, z) It goes a bit further than the short description of the sp package in the latest R-News, and will most likely be a new method for overlay in sp. If these are your 200K points, it may take a little longer ... Cheers, Leaf -- 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] Histogram over a Large Data Set (DB): How?
Sean == Sean Davis [EMAIL PROTECTED] writes: Sean Have you tried just grabbing the whole column using dbGetQuery? Sean Try doing this: Sean Sean spams - dbGetQuery(con,select unixtime from email limit Sean 100) Sean Sean Then increase from 1,000,000 to 1.5 million, to 2 million, etc. Sean until you break something (run out of memory), if you do at all. Yes, you are right. For the example problem that I posed, R can indeed process the entire query result in memory. (The R process grows to 240MB, though!) Sean However, the BETTER way to do this, if you already have the data Sean in the database is to allow the database to do the histogram for Sean you. For example, to get a count of spams by day, in MySQL do Sean something like: [...] Yes, again you are right --- the particular problem that I posed is probably better handled by formulating a more sophisticated SQL query. But really, my goal isn't to solve the the example problem that I posed --- rather, it is to understand how people use R to process very large data sets. The research project that I'm working on will eventually need to deal with query results that cannot fit in main memory, and for which the built-in statistical facilities of most DBMSs will be insufficient. Some of my colleagues have previously written their analyses by hand, using various scripting languages to read and process records from a DB in chunks. Writing things in this way, however, can be tedious and error-prone. Instead of taking this approach, I would like to be able to use existing statistics packages that have the ability to deal with large datasets in good ways. So, I seek to understand the ways that people deal with these sorts of situations in R. Your advice is very helpful --- one should solve problems in the simplest ways available! --- but I would still like to understand the harder cases, and how one can use general R functions in combination with DBI's `dbApply' and `fetch' interfaces, which divide results into chunks. Thanks! Eric. -- --- Eric Eide [EMAIL PROTECTED] . University of Utah School of Computing http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX __ 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 plot two dataset in one fig?
If I understand your question, to superimpose two lines in a same plot, in the first call to plot() you want to set the plot(ylim) argument with a range that will fit both of your lines. Then use lines() to add the second lowess line on the plot. Or matplot() will automate the process for you. Take a look at savePlot() to save your final figure. Francisco From: Wei Qiu [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] How to plot two dataset in one fig? Date: Fri, 18 Nov 2005 16:38:48 -0500 (EST) Hi all, I am new in R tool. I would like to plot two dataset in in fig. Here is what I did for both a and b data sets jpeg(file=a.jpeg) dat-read.table('a', header=F, sep=',') dim(dat) y-dat[,1] y-y[!is.na(y)] plot(y);lines(lowess(y, f=0.05), col = (red), lwd=5) dev.off Two questions: 1. How I can save this lowess smooth data? 2. Once I have the smooth a and b data, How I can put two smooth data sets in one fig even they have different Y ranger value? Any input will be greatly appreciated. Lucy __ 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] Point pattern to grid
On Fri, 18 Nov 2005, Leaf Sun wrote: Hi Roger, Thanks again for your kind help. Yes, I still use the 200K points data applying this program but the good thing is I found it finished in no time. The reply is on R-sig-geo. The questions again here are: 1) try0 - lapply(split(as(df1, data.frame), res), mean) When I tried to replace mean to sum, error looks like this: Error in [EMAIL PROTECTED], i, drop = FALSE] : undefined columns selected 2) If I just need to know the number of points in each cells, how can I modify the codes. The codes still a bit beyond me. Thanks! Leaf === At 2005-11-18, 01:39:05 you wrote: === On Thu, 17 Nov 2005, Leaf Sun wrote: Dear all, I'd like to change a point pattern to a grid of cells and use one of the variables as the output. e.g. The point pattern is of a window of (500*500) and several features such as pH, SoilType etc. I like to divide it into a grid with cell size 5*5, and use the mean of the point values falling inside the cell as the output. Is there any package in R working with this? Thanks in advance! This might have been better posted on R-sig-geo. Try this: library(sp) df1 - data.frame(x=runif(1,0,500), y=runif(1,0,500), z=rnorm(1)) coordinates(df1) - c(x, y) summary(df1) # SpatialPointsDataFrame grd - GridTopology(c(2.5,2.5), c(5,5), c(100,100)) sgrd - SpatialGrid(grd) #SpatialGrid bbox(sgrd) res - overlay(sgrd, df1) # find which grid cells the points are in str(res) try0 - lapply(split(as(df1, data.frame), res), mean) # take means by grid cell - assumes all numeric columns in df1 # (soil type??) - maybe write a custom function to handle non-numeric # columns sensibly try01 - vector(mode=list, length=prod(slot(slot(sgrd, grid), cells.dim))) nafill - rep(as.numeric(NA), ncol(as(df1, data.frame))) try01 - lapply(try01, function(x) nafill) # make a container to put the means in with the right number of columns try01[as.integer(names(try0))] - try0 # insert means into correct list elements try1 - data.frame(t(data.frame(try01))) # transpose summary(try1) sgrd1 - SpatialGridDataFrame(slot(sgrd, grid), try1) image(sgrd1, x) image(sgrd1, y) image(sgrd1, z) It goes a bit further than the short description of the sp package in the latest R-News, and will most likely be a new method for overlay in sp. If these are your 200K points, it may take a little longer ... Cheers, Leaf -- 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] = = = = = = = = = = = = = = = = = = = = -- 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] Histogram over a Large Data Set (DB): How?
Eric Eide wrote: Sean == Sean Davis [EMAIL PROTECTED] writes: Sean Have you tried just grabbing the whole column using dbGetQuery? Sean Try doing this: Sean Sean spams - dbGetQuery(con,select unixtime from email limit Sean 100) Sean Sean Then increase from 1,000,000 to 1.5 million, to 2 million, etc. Sean until you break something (run out of memory), if you do at all. Yes, you are right. For the example problem that I posed, R can indeed process the entire query result in memory. (The R process grows to 240MB, though!) Sean However, the BETTER way to do this, if you already have the data Sean in the database is to allow the database to do the histogram for Sean you. For example, to get a count of spams by day, in MySQL do Sean something like: [...] Yes, again you are right --- the particular problem that I posed is probably better handled by formulating a more sophisticated SQL query. But really, my goal isn't to solve the the example problem that I posed --- rather, it is to understand how people use R to process very large data sets. The research project that I'm working on will eventually need to deal with query results that cannot fit in main memory, and for which the built-in statistical facilities of most DBMSs will be insufficient. Some of my colleagues have previously written their analyses by hand, using various scripting languages to read and process records from a DB in chunks. Writing things in this way, however, can be tedious and error-prone. Instead of taking this approach, I would like to be able to use existing statistics packages that have the ability to deal with large datasets in good ways. So, I seek to understand the ways that people deal with these sorts of situations in R. Your advice is very helpful --- one should solve problems in the simplest ways available! --- but I would still like to understand the harder cases, and how one can use general R functions in combination with DBI's `dbApply' and `fetch' interfaces, which divide results into chunks. You might be interested in our project: NetEpi Analysis, which aims to provide interactive exploratory data analysis and basic epidemiological analysis via both a Web front end and a Python programmatic API (forgive the redundancy in programmatic API) for datests up to around 30 million rows (and as many columns as you like) on 32 bit platforms - hundreds of millions of rows should be feasible on 64-bit platforms. It stores data column-wise in memory-mapped on-disc arrays, and uses set operations on ordinal indexes to permit rapid subsetting and cross-tabulation of categorical (factored) data. It is written in Python, but uses R for graphics and some (but not all) statistical calculations (and for model fitting when we get round to providing facilities for same). See http://www.netepi.org - still in alpha, with an update coming out by December. Although it is aimed at epidemiological analysis (of large administrative health datasets), I dare say it might be useful for exploring large databases of spam too. Tim C __ 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] Batchjob creates small object but large workspace ???
I ran into an interesting problem that I think I have solved. I ran a batch job as --no-save, electing only to save all objects there before the job started and one reasonably small object created as the result of the job, ( ~ 19K ). During the course of the job several large objects are generated, but not among the list of things which are saved. The interesting problem is that the .RData file ends up being around 250 MB in size larger than it was previously. Inside of R, object.size returns a reasonably accurate estimate, 19K, but somehow there is hidden junk. I am trying, as a write, the solution the problem. Before the save command at the bottome of the batch file I should delete the un-needed large objects and then call gc() . My thought is that the save operation needs to generate a large temporary file and then copy only the parts of it that are requested to be saved and this takes nearly all of my 1GB of system memory so that the poor gc program is shoved off the stack (or some semblence of this reasoning at least). Oh... (not so) great news... the job just finished and it looks like my idea was incorrect. So I am open to suggestions! .RData before run:88951444 bytes .RData after run:345671147 bytes size of object saved: 190588 bytes and by the way, I have good reason to trust the 19K estimate since the information contained in the object fits on about 3 screens. __ 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] [package concord] seeking maintainer
Hi, can anybody tell me how to contact the maintainer of the concord package? The address given in the help file is not valid anymore. , | help(package=concord) | | Information für Paket 'concord' | | Description: | | Package: concord | Version: 1.4-2 | Date: 2005-05-10 | Title: Concordance and reliability | Author:Jim Lemon [EMAIL PROTECTED] | Maintainer:Jim Lemon [EMAIL PROTECTED] ` , | [EMAIL PROTECTED]: host 138.25.243.40[138.25.243.40] said: 550 5.1.6 | recipient no longer on server: [EMAIL PROTECTED] (in reply to RCPT TO | command) ` TIA Regards Patrick -- The shortest unit of time in the universe is the New York Second, defined as the period of time between the traffic lights turning green and the cab behind you honking. -- Terry Pratchett 'Lords and Ladies' __ 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] [package concord] seeking maintainer
On Sat, 2005-11-19 at 00:37 +, Patrick Drechsler wrote: Hi, can anybody tell me how to contact the maintainer of the concord package? The address given in the help file is not valid anymore. , | help(package=concord) | | Information für Paket 'concord' | | Description: | | Package: concord | Version: 1.4-2 | Date: 2005-05-10 | Title: Concordance and reliability | Author:Jim Lemon [EMAIL PROTECTED] | Maintainer:Jim Lemon [EMAIL PROTECTED] ` , | [EMAIL PROTECTED]: host 138.25.243.40[138.25.243.40] said: 550 5.1.6 | recipient no longer on server: [EMAIL PROTECTED] (in reply to RCPT TO | command) ` TIA Regards Patrick A quick search of this month's r-help archive reveals: [EMAIL PROTECTED] HTH, Marc Schwartz __ 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] [package concord] seeking maintainer
Marc Schwartz wrote on 19 Nov 2005 02:07:09 MET: On Sat, 2005-11-19 at 00:37 +, Patrick Drechsler wrote: can anybody tell me how to contact the maintainer of the concord package? The address given in the help file is not valid anymore. [...] A quick search of this month's r-help archive reveals: [EMAIL PROTECTED] HTH, Thanks Marc! Regards Patrick -- Photons have mass!!?? I didn't even know they were Catholic... __ 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