Re: [R] Help with filled.contour()
Michael Kubovy kubovy at virginia.edu writes: I tried and it gave a strange result. See http://people.virginia.edu/~mk9y/mySite/twoGaussian.R and http://people.virginia.edu/~mk9y/mySite/twoGaussian.pdf * Session Info * sessionInfo() R version 2.4.1 (2006-12-18) powerpc-apple-darwin8.8.0 Hmm, strange, I can reproduce your problem on Windows (otherwise same config) with pdf, but it looks beautifully on screen for me if I mentally remove the ugly legend. Dieter __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] SNA Matrix
Hello I export a one mode network from Pajek to R, and the former made an .r file called PajekR.r, that is actually an script to be run in R The problem is that what the file actually does is to set a 0 martrix and then assing to each pair of nodes the corresponding values. Since the matrix is huge (10.000 nodes) a copy/paste procedure is very time consuming, and I guess pretty inefficient. So the question is: are there any way to read directly the .r file in R, without copy and paste the sentences of the script in the R console? Erica H. Salvaj PhD Candidate IESE Business School [EMAIL PROTECTED] This message has been scanned for viruses by TRENDMICRO,\ an...{{dropped}} __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] SNA Matrix
Salvaj, Erica wrote: Hello I export a one mode network from Pajek to R, and the former made an .r file called PajekR.r, that is actually an script to be run in R The problem is that what the file actually does is to set a 0 martrix and then assing to each pair of nodes the corresponding values. Since the matrix is huge (10.000 nodes) a copy/paste procedure is very time consuming, and I guess pretty inefficient. So the question is: are there any way to read directly the .r file in R, without copy and paste the sentences of the script in the R console? The command you are looking for is source. If PajekR.r resides in your working directory, it is as easy as source(PajekR.r) Otherwise replace PajekR.r with the full path to this file. An other option would be source(choose.files()) which fires up a GUI that lets you browse for the file. HTH, Tobias Erica H. Salvaj PhD Candidate IESE Business School [EMAIL PROTECTED] This message has been scanned for viruses by TRENDMICRO,\ an...{{dropped}} __ 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 and provide commented, minimal, self-contained, reproducible code. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] How to extract the variance componets from lme
Here is a piece of code fitting a model to a (part) of a dataset, just for illustration. I can extract the random interaction and the residual variance in group meth==1 using VarCorr, but how do I get the other residual variance? Is there any way to get the other variances in numerical form directly - it seems a litte contraintuitive to use as.numeric when extracting estimates, it's a bit like good old days writing SAS-programs that reads the SAS output files... Bendix --- library( nlme ) dfr - structure(list(meth = structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), .Label = c(CO, pulse), class = factor), item = c(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4), repl = c(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3), y = c(78, 76.4, 77.2, 68.7, 67.6, 68.3, 82.9, 80.1, 80.7, 62.3, 65.8, 67.5, 71, 72, 73, 68, 67, 68, 82, 77, 77, 43, 69, 77)), .Names = c(meth, item, repl, y), row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195), class = data.frame) m1 - lme( y ~ factor( meth ) + factor( item ), random = ~1 | MI, weights = varIdent( form = ~1 | meth ), method =REML, data = cbind( dfr, MI=interaction( dfr$meth, dfr$item ) ) ) m1 # The MI std and the residual std for meth==1 as.numeric(VarCorr(m1)[,2]) __ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) +45 44 43 73 13 (fax) [EMAIL PROTECTED] http://www.biostat.ku.dk/~bxc __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] RMySQL adn FC6 - install fail
Dear anybody I am running Fedora Core 6 with the latest version of R. When I try to install the package RMySQL I get this message: * Installing *source* package 'RMySQL' ... creating cache ./config.cache checking how to run the C preprocessor... /lib/cpp checking for compress in -lz... no checking for getopt_long in -lc... no checking for mysql_init in -lmysqlclient... no checking for mysql.h... no checking for mysql_init in -lmysqlclient... no checking for mysql_init in -lmysqlclient... no checking for mysql_init in -lmysqlclient... no checking for mysql_init in -lmysqlclient... no checking for mysql_init in -lmysqlclient... no Configuration error: Could not locate the library libz required by MySQL. INSTRUCTIONS: The libz library is required by the MySQL client library in order to compress/uncompress connections between clients and the MySQL engine. Make sure you have libz installed properly and/or included in your $LD_LIBRARY_PATH. Perhaps it is not in any of the standard directories (e.g., /usr/lib/, /usr/local/lib)? Aborting the installation of RMySQL. I haev checked my installation adn foudn teh follwing files: /usr/lib/libz.so (whcih points to) /usr/lib/libz.so.1.2 Any help woudl be appreciated. I couldn't find anytign in teh archives. Richard __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to extract the variance componets from lme
I advice you strongly to use VarCorr(), but if you insist tmp - as.matrix(m1$modelStruct$reStruct$MI) c(sqrt(diag(tmp)), Residual = 1) * m1$sigma Joris [EMAIL PROTECTED] wrote on 02/01/2007 12:50:05: Here is a piece of code fitting a model to a (part) of a dataset, just for illustration. I can extract the random interaction and the residual variance in group meth==1 using VarCorr, but how do I get the other residual variance? Is there any way to get the other variances in numerical form directly - it seems a litte contraintuitive to use as.numeric when extracting estimates, it's a bit like good old days writing SAS-programs that reads the SAS output files... Bendix --- library( nlme ) dfr - structure(list(meth = structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), .Label = c(CO, pulse), class = factor), item = c(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4), repl = c(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3), y = c(78, 76.4, 77.2, 68.7, 67.6, 68.3, 82.9, 80.1, 80.7, 62.3, 65.8, 67.5, 71, 72, 73, 68, 67, 68, 82, 77, 77, 43, 69, 77)), .Names = c(meth, item, repl, y), row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195), class = data.frame) m1 - lme( y ~ factor( meth ) + factor( item ), random = ~1 | MI, weights = varIdent( form = ~1 | meth ), method =REML, data = cbind( dfr, MI=interaction( dfr$meth, dfr$item ) ) ) m1 # The MI std and the residual std for meth==1 as.numeric(VarCorr(m1)[,2]) __ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) +45 44 43 73 13 (fax) [EMAIL PROTECTED] http://www.biostat.ku.dk/~bxc __ 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 and provide commented, minimal, self-contained, reproducible code. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] [R-pkgs] pls version 2.0-0
Version 2.0-0 of the pls package is now available on CRAN. The pls package implements partial least squares regression (PLSR) and principal component regression (PCR). Features of the package include - Several plsr algorithms: orthogonal scores, kernel pls and simpls - Flexible cross-validation - A formula interface, with traditional methods like predict, coef, plot and summary - Functions for extraction of scores and loadings, and calculation of (R)MSEP and R2 - Functions for plotting predictions, validation statistics, coefficients, scores, loadings, biplots and correlation loadings. The main changes since 1.2-0 are - There is now an options mechanism for selecting default fit algorithms. See ?pls.options. - loadingplot() and coefplot() now try to be more intelligent when plotting x axis labels. - The handling of factors in X has been improved, by changing the way the intercept is removed from the model matrix. - All PLSR and PCR algorithms, as well as mvrCv(), have been optimised. Depending on the algorithm used, the size of the matrices, and the number of components used, one can expect from 5% to 65% reduction in computation time. - Scaling of scores and loadings of kernel PLS and svd PCR algorithm has changed. They are now scaled using the `classic' scaling found in oscorespls. - The arguments `ncomp' now always means number of components, and `comps' always means component number. The argument `cumulative' has been removed. - A new data set 'gasoline' has been included. - The 'NIR' and 'sensory' data sets have been renamed to 'yarn' and 'oliveoil'. See the file CHANGES in the sources for all changes. -- Bjørn-Helge Mevik ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] en congé
Je serai absent(e) à partir du 02/01/2007 de retour le 08/01/2007. Vous pouvez contacter M.Bidart en mon absence. Bonne année 2007 Si vous n'etes pas destinataires de ce message, merci d'aver...{{dropped}} __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Does SQL group by have a heavy duty equivalent in R
On 1/1/07, Prof Brian Ripley [EMAIL PROTECTED] wrote: And it works perfectly well with RODBC, so you don't need yet another package. RODBC even comes with SQLite examples. Thanks, I hadn't thought of that and it should simplify things as we are already using RODBC for MySQL. BTW, 'fast' is rather misleading: SQLite is often fast for small tasks, but can be very slow compared to a more serious DBMS. Agreed. We switch to MySQL for larger jobs. jab -- John Bollinger, CFA, CMT www.BollingerBands.com If you advance far enough, you arrive at the beginning. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] RMySQL adn FC6 - install fail
R Gott wrote: (With a name like that you'd better get good at this) ;-) Dear anybody I am running Fedora Core 6 with the latest version of R. When I try to install the package RMySQL I get this message: * Installing *source* package 'RMySQL' ... creating cache ./config.cache checking how to run the C preprocessor... /lib/cpp checking for compress in -lz... no checking for getopt_long in -lc... no checking for mysql_init in -lmysqlclient... no checking for mysql.h... no checking for mysql_init in -lmysqlclient... no checking for mysql_init in -lmysqlclient... no checking for mysql_init in -lmysqlclient... no checking for mysql_init in -lmysqlclient... no checking for mysql_init in -lmysqlclient... no Configuration error: Could not locate the library libz required by MySQL. INSTRUCTIONS: The libz library is required by the MySQL client library in order to compress/uncompress connections between clients and the MySQL engine. Make sure you have libz installed properly and/or included in your $LD_LIBRARY_PATH. Perhaps it is not in any of the standard directories (e.g., /usr/lib/, /usr/local/lib)? Aborting the installation of RMySQL. I haev checked my installation adn foudn teh follwing files: /usr/lib/libz.so (whcih points to) /usr/lib/libz.so.1.2 (not .so.1.2.3 ?) Any help woudl be appreciated. I couldn't find anytign in teh archives. Richard Looks like I have [EMAIL PROTECTED] ~]$ rpm -qf /usr/lib64/libz.so zlib-devel-1.2.3-3 [EMAIL PROTECTED] ~]$ rpm -q zlib zlib-1.2.3-3 -- 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 and provide commented, minimal, self-contained, reproducible code.
[R] lattice panel.linejoin type question
Hello R Users! I'm trying to use the panel.linejoin function to draw points and lines (type=o) but it wouldn't do it. Modifying the panel.linejoin function as such (adding type argument to the panel.lines call). *original* panel.lines(vals[xx], yy, col = col.line, lty = lty, lwd = lwd, ...) *modified panel.lines(vals[xx], yy, col = col.line, lty = lty, lwd = lwd, type, ...) Then passing the type=o in the panel.linejoin call as such works. xyplot( ... ,panel.groups=function(x,y,subscripts,...) { panel.linejoin(x,y,fun=mean,type=o,...) } ) However, if I don't add the type in the panel.lines call, I get a formal argument type matched by multiple actual arguments Error. It seems like overkill to redefine panel.lines, is there a simpler way? R 2.4.1 Windows XP Lattice 0.14-16 Best Regards, Sam __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] graphical parameters: margins
Hi all, Please, while using image() which is the graphical parameter which control the space between ylab and the y axis? I do need to write a number of relatively long y labels and I am not able the control, if possible, this space. See the effect I need to avoid... http://nvx.environmentalchange.net/@rrodriguez/images/overlapping.jpg Thanks for your help, Ricardo -- Ricardo Rodríguez Your XEN ICT Team __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] bug in odfWeave
I've verified this bug and will be releasing a new version shortly. Max -Original Message- From: Abhijit Dasgupta [mailto:[EMAIL PROTECTED] Sent: Saturday, December 23, 2006 12:03 AM To: r-help@stat.math.ethz.ch; Kuhn, Max Subject: bug in odfWeave Hi, I think there is a minor bug in odfWeave. In the function odfStyleGen, the following line has an extra =: if(length(grep(italic, thisStyle$fontType))) fontText - c(fontText, tagattr(fo:font-style=, italic)) This is creating an error if some text needs to be formatted as italic, since the corresponding entry in style.xml is fo:font-style==italic. For the windows version, which I'm using, I can't correct since the R files are packaged in odfWeave.rdb (or at least I don't know how). Hopefully Max Kuhn or someone can update the windows binary to correct this. Abhijit Dasgupta PS: I found the bug after downloading the source files. -- LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}} __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Survfit with a coxph object
When I run coxph I get the coxph object back fairly quickly, however when I try to run survfit it does not come back. If you are very, very patient the routine will come back eventually. Unfortunately, for some very large data sets this could be months... The reason is that the algorithms for coxph have been carefully optimized over the years, but survfit is used so much less frequently that I have not propogated many of these improvements forward to that routine. In particular, there is a computation which is O(d*n) if done in the obvious way, but O(2n) when approached more cleverly; where d=number of events and n= number of observations in the data set. Your example has d ~ 50,000 and n~ 100,000, so I would expect survfit.coxph to be roughly 2 times slower than coxph. The long term solution is for me to fix this. It's a couple of week's work, if I can only find the weeks to do it. The mid term one is to take Frank Harrell's suggestion. If standard errors are not needed, there is an O(n) algorithm, which he has implemented as part of his additions to the coxph suite. Terry Therneau __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] graphical parameters: margins
On Tue, 2007-01-02 at 17:02 +0100, Ricardo Rodríguez - Your XEN ICT Team wrote: Hi all, Please, while using image() which is the graphical parameter which control the space between ylab and the y axis? I do need to write a number of relatively long y labels and I am not able the control, if possible, this space. See the effect I need to avoid... http://nvx.environmentalchange.net/@rrodriguez/images/overlapping.jpg Thanks for your help, Ricardo Either of these two gives you the answer help.search(graphical parameters) RSiteSearch(graphical parameters margin) more specifically, read ?par and in particular, the entry for parameter 'mar' and it's relatives. You might also need to add the axis label separately from the figure: opar - par(mar = c(5,7,4,2) +0.1) plot(1:10, ann = FALSE) # or plot(1:10, ylab = ) mtext(label, side = 2, line = 6) par(opar) 1) opar - par(mar = c(5,7,4,2) +0.1) creates 7.1 lines on the left of the plot and saves defaults 2) mtext(label, side = 2, line = 6) displays the axis label on line 6 to push it away from the plot axis. Repeat for other sides... 3) par(opar) resets to the defaults. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] package dependency tree
Is there a painless way to find the names of all packages on CRAN that Depend on a specified package? url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL PROTECTED]Department of Economics vox: 217-333-4558University of Illinois fax: 217-244-6678Champaign, IL 61820 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] user-specified random effects design matrix in glmmPQL?
Hi, I want to do a logistic regression model with random effects but I need to sepcify my own design matrix for the random effects. Can I do it in glmmPQL or anything similar? If so, how? Thanks, Minya __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] R modules
Hi All, I'd like to know what is the best way to organize R code in multiple modules= and files. The R code we are writing is too much for a single file. Besides= , there are a lot of reusable functions we'd like to factor out. But writing= a package for that is quite an over-kill and might be too inflexible. So what is the best way to organize R code into multiple files and reusable= modules? Thanks, Geoffrey ___=0A= =0A= =0A= The information in this email or in any file attached hereto is=0A= intended only for the personal and confidential use of the individual=0A= or entity to which it is addressed and may contain information that is=0A= proprietary and confidential. If you are not the intended recipient of=0A= this message you are hereby notified that any review, dissemination,=0A= distribution or copying of this message is strictly prohibited. This communi= cation is for information purposes only and should not be regarded as an off= er to sell or as a solicitation of an offer to buy any financial product. Em= ail transmission cannot be guaranteed to be secure or error-free. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] package dependency tree
Try this, noting that available.packages() returns a matrix whose columns include Depends and Suggests and whose rownames are the package names: AP - available.packages() rownames(AP)[grep(quantreg, AP[, Depends])] [1] cobsemplik lss rankreg rqmcmb2 rownames(AP)[grep(quantreg, AP[, Suggests])] [1] apTreeshape diveMovedyn ggplot gsubfn [6] np On 1/2/07, roger koenker [EMAIL PROTECTED] wrote: Is there a painless way to find the names of all packages on CRAN that Depend on a specified package? url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL PROTECTED]Department of Economics vox: 217-333-4558University of Illinois fax: 217-244-6678Champaign, IL 61820 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] R modules
You could have a master file that sources the rest: source(A.R) source(B.R) or you could save the function in a workspace and just load it back in; however, at some point I would move that all to a package. I typically will create a package for myself even if I have no intention of distributing it since it nicely puts together all the source and documentation and the checking tools are helpful to improve the QA. Its a bit of work to figure it all out the first time but once you are over that hump its worth it. On 1/2/07, Geoffrey Zhu [EMAIL PROTECTED] wrote: Hi All, I'd like to know what is the best way to organize R code in multiple modules= and files. The R code we are writing is too much for a single file. Besides= , there are a lot of reusable functions we'd like to factor out. But writing= a package for that is quite an over-kill and might be too inflexible. So what is the best way to organize R code into multiple files and reusable= modules? Thanks, Geoffrey ___=0A= =0A= =0A= The information in this email or in any file attached hereto is=0A= intended only for the personal and confidential use of the individual=0A= or entity to which it is addressed and may contain information that is=0A= proprietary and confidential. If you are not the intended recipient of=0A= this message you are hereby notified that any review, dissemination,=0A= distribution or copying of this message is strictly prohibited. This communi= cation is for information purposes only and should not be regarded as an off= er to sell or as a solicitation of an offer to buy any financial product. Em= ail transmission cannot be guaranteed to be secure or error-free. __ 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 and provide commented, minimal, self-contained, reproducible code. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] package dependency tree
Hello, http://bioconductor.org/packages/1.9/bioc/html/pkgDepTools.html resp. http://bioconductor.org/packages/2.0/bioc/html/pkgDepTools.html may help you. Best regards, Matthias Gabor Grothendieck schrieb: Try this, noting that available.packages() returns a matrix whose columns include Depends and Suggests and whose rownames are the package names: AP - available.packages() rownames(AP)[grep(quantreg, AP[, Depends])] [1] cobsemplik lss rankreg rqmcmb2 rownames(AP)[grep(quantreg, AP[, Suggests])] [1] apTreeshape diveMovedyn ggplot gsubfn [6] np On 1/2/07, roger koenker [EMAIL PROTECTED] wrote: Is there a painless way to find the names of all packages on CRAN that Depend on a specified package? url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL PROTECTED]Department of Economics vox: 217-333-4558University of Illinois fax: 217-244-6678Champaign, IL 61820 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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 and provide commented, minimal, self-contained, reproducible code. -- Dr. rer. nat. Matthias Kohl E-Mail: [EMAIL PROTECTED] Home: www.stamats.de __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] package dependency tree
On Tue, 2 Jan 2007 11:20:10 -0600, roger koenker [EMAIL PROTECTED] wrote: Is there a painless way to find the names of all packages on CRAN that Depend on a specified package? Maybe this is not too painful: pkgs - available.packages()# repos arg may be useful here pkgs.dpnd - pkgs[grep(quantreg, pkgs[, Depends]), ] names(pkgs.dpnd) -- Seb __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] package dependency tree
roger koenker wrote: Is there a painless way to find the names of all packages on CRAN that Depend on a specified package? Depends on how accurately you need them. These *probably* depend on boot x - available.packages() rownames(x)[grep(boot,x[,Depends])] [1] circular cramer DCluster equivalence np [6] pastecs relaimpo sensitivity simpleboot spdep [11] survrec titanverification Zelig This allows visual inspection of the Depends fields too: x[grep(boot,x[,Depends]), Depends, drop=F] (There could have been dependencies on, say, simpleboot). For increased precision, you'll need to grep more carefully, for \\boot\\. Finally, catching indirect dependencies requires iterative application, something like this: f - function(s) rownames(x)[grep(paste(\\,s,\\,sep=),x[,Depends])] (y - f(boot)) [1] circular cramer DCluster equivalence np [6] pastecs relaimpo sensitivity simpleboot spdep [11] survrec titanverification Zelig (y0 - unlist(lapply(y,f))) [1] wle DCluster svcR gcmrec VDCutil (y0 - setdiff(y0,y)) [1] wle svcRgcmrec VDCutil (y - union(y, y0)) [1] circular cramer DCluster equivalence np [6] pastecs relaimpo sensitivity simpleboot spdep [11] survrec titanverification Zeligwle [16] svcR gcmrec VDCutil (y0 - unlist(lapply(y0,f))) character(0) ...and stop at this point since there are no more dependents. Otherwise, repeat. -- 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] package dependency tree
On Tue, 2 Jan 2007, roger koenker wrote: Is there a painless way to find the names of all packages on CRAN that Depend on a specified package? Assuming you have just CRAN in your selected repositories: foo - available.packages() deps - strsplit(foo[, Depends], ,[[:space:]]*) names(deps)[sapply(deps, function(x) quantreg %in% x)] [1] cobsemplik lss pheno rankreg rqmcmb2 seems painless enough. -- 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] lattice panel.linejoin type question
On 1/2/07, Walker, Sam [EMAIL PROTECTED] wrote: Hello R Users! I'm trying to use the panel.linejoin function to draw points and lines (type=o) but it wouldn't do it. Modifying the panel.linejoin function as such (adding type argument to the panel.lines call). *original* panel.lines(vals[xx], yy, col = col.line, lty = lty, lwd = lwd, ...) *modified panel.lines(vals[xx], yy, col = col.line, lty = lty, lwd = lwd, type, ...) I think I'll just remove 'type' from the argument list of 'panel.linejoin', unless I see any problems with that change. Deepayan Then passing the type=o in the panel.linejoin call as such works. xyplot( ... ,panel.groups=function(x,y,subscripts,...) { panel.linejoin(x,y,fun=mean,type=o,...) } ) However, if I don't add the type in the panel.lines call, I get a formal argument type matched by multiple actual arguments Error. It seems like overkill to redefine panel.lines, is there a simpler way? R 2.4.1 Windows XP Lattice 0.14-16 Best Regards, Sam __ 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 and provide commented, minimal, self-contained, reproducible code. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] R modules
On 1/2/2007 12:46 PM, Geoffrey Zhu wrote: Hi All, I'd like to know what is the best way to organize R code in multiple modules= and files. The R code we are writing is too much for a single file. Besides= , there are a lot of reusable functions we'd like to factor out. But writing= a package for that is quite an over-kill and might be too inflexible. So what is the best way to organize R code into multiple files and reusable= modules? Write a package for it. It's not overkill, it's using the tools the way they were designed to be used. Not all packages need to be submitted to CRAN, you can have a package for your own use. It gives you a way to organize your code and documentation, numerous code checking tools, namespaces, all sorts of good stuff. 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] package dependency tree
Matthias Kohl [EMAIL PROTECTED] writes: Hello, http://bioconductor.org/packages/1.9/bioc/html/pkgDepTools.html resp. http://bioconductor.org/packages/2.0/bioc/html/pkgDepTools.html may help you. [shameless plug] Last Month's RNews has an article that demonstrates the pkgDepTools package: [144] Seth Falcon. Modeling package dependencies using graphs. R News, 6(5):8-12, December 2006. + 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 and provide commented, minimal, self-contained, reproducible code.
[R] arith-true mean() fails make check on IRIX
Hello, I am building R-2.4.1 on an SGI IRIX platform, using gcc 3.3. gmake check failed, and the arith-true.Rout.fail file indicated: is.na(mean(c(1,NA,NA)[-1], trim = .1, na.rm = TRUE)) [1] FALSE I tried the mean() command in R and got: mean(c(1,NA,NA)[-1], trim = .1, na.rm = TRUE) [1] Inf I think the problem is in the na.rm = TRUE, because I get: mean(c(1,NA,NA)[-1]) [1] NA How serious is this problem, and is there a workaround ? thank you Kate -- Kate Fissell Systems Analyst University of Pittsburgh 3939 O'Hara St. Pittsburgh PA 15260 (412) 624-5279 fax: (412) 624-9149 [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 and provide commented, minimal, self-contained, reproducible code.
[R] Geometric Brownian Process
Dear R People, Consider I have 3 realizations of an Geometric Brownian process. Now i want to overlay the plot of these realizations. In a future point in time a probability density curve in this specific point of time should overlay this plot ( view rotated 90°). I am sorry for not providing any source code. Can anybody point mo to an package, or has anybody an idea how to simulate an geometric brownian process in R? Thanks in advance, Michael Graber __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] SNA Matrix
?source Salvaj, Erica wrote: Hello I export a one mode network from Pajek to R, and the former made an .r file called PajekR.r, that is actually an script to be run in R The problem is that what the file actually does is to set a 0 martrix and then assing to each pair of nodes the corresponding values. Since the matrix is huge (10.000 nodes) a copy/paste procedure is very time consuming, and I guess pretty inefficient. So the question is: are there any way to read directly the .r file in R, without copy and paste the sentences of the script in the R console? Erica H. Salvaj PhD Candidate IESE Business School [EMAIL PROTECTED] This message has been scanned for viruses by TRENDMICRO,\ an...{{dropped}} __ 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 and provide commented, minimal, self-contained, reproducible code. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey. __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] Problem labeling arrays
Hi all. I'am sitting for hours. I have a problem labelling arrays. I am loosing labels for higher dimensions than matrices. Has anyone already faced that problem? There must be some direct way without writing complicated functions. Thanks for any hint. greetings lars x-matrix(sin(1:90),nrow=100,ncol=9) dimnames(x)[[2]]-c(F1_5, F2_5, F3_5,F4_5, F5_5,F6_5, F7_5, F8_5, F9_5) partialCorr - function (cond, mat) cor(qr.resid(qr(cbind(1, mat[, cond])), mat[, -cond])) # matrix keep label d=partialCorr(c(3,2),x) d # array looses label bsp1 - array(0, c(7,7,36)) k - 0 for(i in 1:8) for(j in (i+1):9) { k - k+1 bsp1[, , k] - partialCorr(c(i, j), x) } bsp1 # I tried something to label inside the loop bsp1 - array(0, c(7,7,36)) k - 0 for(i in 1:8) for(j in (i+1):9) { k - k+1 bsp1[, , k] - partialCorr(c(i, j), x) dimnames(bsp1[,,k])=dimnames(partialCorr(c(i,j), x)) } bsp1 # I tried something to label outside the loop but can't directy adress the array labels - array(0, c(7,1,36)) k - 0 for(i in 1:8) for(j in (i+1):9) { k - k+1 labels[, , k] - as.vector(rownames(partialCorr(c(i,j), x))) } labels for (k in 1:36){ dimnames(bsp1[,,k])=list(c(labels[,1,k]),c(labels[,1,k])) } bsp1 -- View this message in context: http://www.nabble.com/-R--Problem-labeling-arrays-tf2910585.html#a8132366 Sent from the R help mailing list archive at Nabble.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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Geometric Brownian Process
This function samples from the solution to the stochastic differential equation of the geometric wiener process: rgwiener - function (n=1, t=1, S0=1000, mu=0, sigma=1) { S0 * exp((mu - 1/2 * sigma^2) * t + sigma * sqrt(t) * rnorm(n)) } To test this, note that the geometric wiener process has log(S_t/S0) ~ N((mu -1/2*sigma^2)* t, sigma^2 * t) So if we let mu = 0, sigma = 1, t =1, S0 = 1000, log(S_t/S0) should be ~ Normal(-0.5, 1). samp - log(rgwiener(10)/1000) hist(samp) library(MASS) fitdistr(samp, normal) meansd -0.5005531891.32814 ( 0.003162381) ( 0.002236141) which looks good to me. Because the geometric wiener process is a transformation of the ordinary wiener process, we can simulate it easily enough (apologies to the authors of package e1071, whose function rwiener I hacked): gwiener - function (mu=0, sigma=1, S0=1000, frequency=1000) { z - S0 * exp((mu - 1/2 * sigma^2) * seq(0, 1, length=frequency) + sigma * cumsum(rnorm(frequency)/sqrt(frequency))) ts(z, start = 1/frequency, frequency=frequency) } plot(gwiener(), type=l) Looks ok. Cheers, Simon. Michael Graber wrote: Dear R People, Consider I have 3 realizations of an Geometric Brownian process. Now i want to overlay the plot of these realizations. In a future point in time a probability density curve in this specific point of time should overlay this plot ( view rotated 90°). I am sorry for not providing any source code. Can anybody point mo to an package, or has anybody an idea how to simulate an geometric brownian process in R? Thanks in advance, Michael Graber __ 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 and provide commented, minimal, self-contained, reproducible code. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] SQLite: When reading a table, a \r is padded onto the last column. Why?
Hi, I put the iris data into a SQLite database with dbWriteTable(con, iris, iris, row.names=F, overwrite = T) Then I retrieve data from the database with rs - dbSendQuery(con, select * from iris) d1 - fetch(rs) dbClearResult(rs) Then I get head(d1) Sepal_Length Sepal_Width Petal_Length Petal_Width Species 1 5.1 3.5 1.4 0.2 setosa\r 2 4.9 3.0 1.4 0.2 setosa\r 3 4.7 3.2 1.3 0.2 setosa\r 4 4.6 3.1 1.5 0.2 setosa\r 5 5.0 3.6 1.4 0.2 setosa\r 6 5.4 3.9 1.7 0.4 setosa\r Can anyone explain the extra \r at the end? I am on Windows XP using R 2.4.1 Thanks in advance Søren __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Any container in R?
Hi Thomas: Thanks for your explanation. You are right that in C++, we try to use the same piece of codes on different type of objects. While in R, most operations are done in a vector way automatically, which reduced the need for containers. Best, Feng - Original Message - From: Thomas Lumley [EMAIL PROTECTED] To: Feng Qiu [EMAIL PROTECTED] Cc: Duncan Murdoch [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Sent: Monday, January 01, 2007 3:21 PM Subject: Re: [R] Any container in R? On Mon, 1 Jan 2007, Feng Qiu wrote: Hi Duncan: Thank you very much! I checked out unique(), it does exactly what I want. But I'm still curious about if R provides STL(standard template library). No. Some things the STL does aren't needed in R, others are implemented differently, and others aren't implemented. One particularly important example is iterators, which will often either happen invisibly due to vectorized operations or will be done with the *apply family of functions. Your example could have been done either way. Using duplicated() is the vectorized approach; the apply approach would use tapply(). C++ is not terribly similar to R. A lot of the effort in STL is expended on allowing a piece of code to be used on different types (where appropriate). In R you have to expend effort on stopping a piece of code being used on different types (where inappropriate). -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] graphical parameters: margins
-- Ricardo Rodríguez Your XEN ICT Team Gavin Simpson[EMAIL PROTECTED] 2/1/2007 17:44 Either of these two gives you the answer help.search(graphical parameters) RSiteSearch(graphical parameters margin) more specifically, read ?par and in particular, the entry for parameter 'mar' and it's relatives. You might also need to add the axis label separately from the figure: opar - par(mar = c(5,7,4,2) +0.1) plot(1:10, ann = FALSE) # or plot(1:10, ylab = ) mtext(label, side = 2, line = 6) par(opar) 1) opar - par(mar = c(5,7,4,2) +0.1) creates 7.1 lines on the left of the plot and saves defaults 2) mtext(label, side = 2, line = 6) displays the axis label on line 6 to push it away from the plot axis. Repeat for other sides... 3) par(opar) resets to the defaults. HTH Thanks Gavin, I frequently reach the help page or any other document concerning the doubt, but at least for me it is by no means easy to correctly interpret their contents without the help of more experienced people. I do hope I will catch up ASAP! Cheers, Ricardo __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] [R-pkgs] rcompletion update
Hi, The rcompletion package, originally intended to provide completion for readline-based R interfaces, has undergone a number of changes. These changes are summarised below: o Reorganisation: - The package has been split into two. All the completion code has been moved to a pure R package called 'rcompgen'. 'rcompletion' now requires 'rcompgen' and simply provides readline bindings that uses 'rcompgen' to generate possible completions. (Source packages are available on CRAN, binaries should be available soon.) - The purpose of this reorganisation is to allow other backends to use the completion facilities provided by 'rcompgen', hopefully avoiding duplication of effort. I'm happy to add further infrastructure to 'rcompgen' if that is helpful. - as a proof of concept, .../examples/altesscomp.el contains code that provides an alternative (using 'rcompgen') to ESS's built-in completion mechanism. It should be enough to include the contents of this file in ~/.emacs (please read the comments at the end before doing so). The file is also available at http://rcompletion.googlecode.com/svn/trunk/rcompgen/inst/examples/altesscomp.el I am particularly interested in feedback from ESS users regarding how this compares with the default mechanism in terms of speed (especially in older machines). o Hosting: - The project is now hosted on Google Code, at http://code.google.com/p/rcompletion/ - (For those interested, this now also hosts my R bash_completion script) o New completion features: - when the token is determined to be the first argument of library() or require(), completion is done on _installed_ package names. This is disabled by default since the first call to installed.packages() can be slow (especially when using remote file systems). - when the token is determined to be the first argument of data(), completion is done on available data sets. - tokens after a question mark (?) match aliases in help topics rather than object names. So, for example, ?INST will complete to ?INSTALL even though there is no object named INSTALL. - the old behaviour of appending a left-parenthesis to function names has been disabled by default, since this requires evaluation of the mode of _all_ matches, which is undesirable for lazy-loaded symbols. As always, comments and suggestions are most welcome. -Deepayan ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ 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 and provide commented, minimal, self-contained, reproducible code.