[R] Again on overlaying plots (a plot region within a plot region)
Dear R-users, after seeking for help in R-search I did not find any hint on my particular problem. Countless help on true overlay, but nothing on this. Please consider the following: par(mfrow = c(2, 1)) T - seq(0, 20, by = 0.01) ## PLOT 1 plot(T, 30*exp(-0.65*T), type = l ) points(T, 30*exp(-0.26 * T), type = l, lty = F8) points(T, 30*exp(-0.15 * T), type = l, lty = 39) ## PLOT 2 plot(T, 30*exp(-0.65*T), type = l, log= y ) points(T, 30*exp(-0.26 * T), type = l, lty = F8) points(T, 30*exp(-0.15 * T), type = l, lty = 39) What I would like to do is to draw a square plot of PLOT 1 and then overlay the *entire* PLOT 2 on the upper right corner of PLOT 1, when there's a lot of empty space I have to do that because the publisher asked me not to waste much space with figures. I studied for some time the Paul Murrell's excellent book R Graphics, but I did not find what I'm looking for. As far as I understand, layout() is intended to flexibly divide the plot region, not to subdivide the plot region nor the figure region. One solution could be to export PLOT 1 , say as png, and then overlay on it PLOT 2 with pixmap() as in this example http://www.stat.auckland.ac.nz/~paul/RGraphics/custombase-pixmap.R but it seems to me a bit too much complicate Thanks in advance for your time -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Ubuntu 8.04.3 LTS -- GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.9) ESS version 5.5 -- R 2.10.0 __ R-help@r-project.org 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] Odp: Again on overlaying plots (a plot region within a plot region)
Hi r-help-boun...@r-project.org napsal dne 02.12.2009 09:15:05: Dear R-users, after seeking for help in R-search I did not find any hint on my particular problem. Countless help on true overlay, but nothing on this. Please consider the following: par(mfrow = c(2, 1)) Do not use T as a name for object as it can be confused with logical T/F par(fig=) is what you want. T - seq(0, 20, by = 0.01) ## PLOT 1 plot(T, 30*exp(-0.65*T), type = l ) points(T, 30*exp(-0.26 * T), type = l, lty = F8) points(T, 30*exp(-0.15 * T), type = l, lty = 39) ## PLOT 2 par(new=TRUE) par(fig=c(.3,.95,.4,.95)) plot(T, 30*exp(-0.65*T), type = l, log= y ) points(T, 30*exp(-0.26 * T), type = l, lty = F8) points(T, 30*exp(-0.15 * T), type = l, lty = 39) Regards Petr What I would like to do is to draw a square plot of PLOT 1 and then overlay the *entire* PLOT 2 on the upper right corner of PLOT 1, when there's a lot of empty space I have to do that because the publisher asked me not to waste much space with figures. I studied for some time the Paul Murrell's excellent book R Graphics, but I did not find what I'm looking for. As far as I understand, layout() is intended to flexibly divide the plot region, not to subdivide the plot region nor the figure region. One solution could be to export PLOT 1 , say as png, and then overlay on it PLOT 2 with pixmap() as in this example http://www.stat.auckland.ac.nz/~paul/RGraphics/custombase-pixmap.R but it seems to me a bit too much complicate Thanks in advance for your time -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Ubuntu 8.04.3 LTS -- GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.9) ESS version 5.5 -- R 2.10.0 __ R-help@r-project.org 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@r-project.org 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] Finding correlation between 2 variables from forcast
Hi, My question may be very stupid for most of you but I'm starting using R and I'm not that familiar with statistics / econometrics. I have 2 series of forecasts, let's say A and B (1 to 120 quarters) and I need to generate the correlation coefficients between the 2 series but for each period. To sum up I should get 120 coefficients Thank you for your help Kind regards Matthew -- View this message in context: http://n4.nabble.com/Finding-correlation-between-2-variables-from-forcast-tp932861p932861.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Incorporating the results of White's HCCM into a linear regression:
Using hccm() I got a heteroscedasticity correction factor on the diagonal of the return matrix, but I don't know how to incorporate this into my linear model: METHOD 1: OLS1 - lm(formula=uer92~uer+low2+mlo+spec+degree+hit) Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) -0.0623377 0.0323461 -1.927 0.057217 . uer 0.2274742 0.0758720 2.998 0.003541 ** low2 0.0276404 0.0375770 0.736 0.463973 mlo 0.1491490 0.0940637 1.586 0.116455 spec-0.1139978 0.0312223 -3.651 0.000445 *** degree 0.0014694 0.0005316 2.764 0.006970 ** hit -0.0164365 0.0186028 -0.884 0.379376 hccm(OLS1) (Intercept) uer low2 mlo spec (Intercept) 9.057187e-04 -1.330377e-03 -3.486945e-05 2.184561e-04 -4.061445e-04 uer -1.330377e-03 5.471543e-03 3.513046e-04 -4.294427e-04 1.629196e-03 low2-3.486945e-05 3.513046e-04 1.378587e-03 1.241245e-04 -5.026434e-05 mlo 2.184561e-04 -4.294427e-04 1.241245e-04 9.796132e-03 -1.059611e-03 spec-4.061445e-04 1.629196e-03 -5.026434e-05 -1.059611e-03 9.777099e-04 degree 9.638288e-07 -2.907824e-05 -1.093692e-05 -1.867397e-05 -8.212461e-06 hit -3.299600e-04 -2.242984e-04 1.036364e-04 -8.158489e-04 3.994951e-05 degree hit (Intercept) 9.638288e-07 -3.299600e-04 uer -2.907824e-05 -2.242984e-04 low2-1.093692e-05 1.036364e-04 mlo -1.867397e-05 -8.158489e-04 spec-8.212461e-06 3.994951e-05 degree 3.485174e-07 4.256330e-06 hit 4.256330e-06 4.154505e-04 I have reached my limit of R knowledge, any help is appreciated. [[alternative HTML version deleted]] __ R-help@r-project.org 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 with Cannot compute correct p-values with ties
Dear All, 1. why did the problem happen? 2. How to solve it? -- Best wishes, Zhijiang Wang PHD Student Room 212, Science buliding, The International WIC Institute, College of Computer Science and Technology, Beijing University of Technology, Beijing, China. __ R-help@r-project.org 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 plot log-log figure using R?
Dear David, Thank you very much! I computed log values firstly. David Winsemius åé: ?plot.default On Dec 1, 2009, at 8:39 AM, Zhijiang Wang wrote: snipped David Winsemius, MD Heritage Laboratories West Hartford, CT -- Best wishes, Zhijiang Wang PHD Student Room 212, Science buliding, The International WIC Institute, College of Computer Science and Technology, Beijing University of Technology, Beijing, China. __ R-help@r-project.org 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] Normal tests disagree?
rkevinbur...@charter.net wrote: If I have data that I feed into shapio.test and jarque.bera.test yet they seem to disagree. What do I use for a decision? I feel those testing for normality in real applied work always have some masochistic attitude. This attitude is squared if they/you even try out a second test. There are three possible results: 1. Both tests do not reject: You still do not know if the underlying distribution is normal. Hence a useless result. 2. Both tests do reject: You know with some probability 1-\alpha that your data are not normal but you do not know what to do next now - except for things that are obvious when looking at you data - and you should have done that before the analysis anyway. If nothing was obvious before, you will hide your finding about the non-normality now - or use another method that might be less powerful given the difference from normality is not really big. 3. Your case, one test rejects, the other one not: Welcome, you finally arrived in hell. Best wishes, Uwe Ligges For my data set I have p.value of 0.05496421 returned from the shapiro.test and 0.882027 returned from the jarque.bera.test. I have included the data set below. Thank you. Kevin Category,Period,Residual CHILD HATS, WIGS MASKS,1/1/2005,-0.449735723758323 CHILD HATS, WIGS MASKS,2/1/2005,0.281461045050074 CHILD HATS, WIGS MASKS,3/1/2005,0.591383050911335 CHILD HATS, WIGS MASKS,4/1/2005,0.239998659520616 CHILD HATS, WIGS MASKS,5/1/2005,0.00343879474063987 CHILD HATS, WIGS MASKS,6/1/2005,-2.64372061292663 CHILD HATS, WIGS MASKS,7/1/2005,0.381630655290173 CHILD HATS, WIGS MASKS,8/1/2005,-1.79543281552347 CHILD HATS, WIGS MASKS,9/1/2005,1.90631012440313 CHILD HATS, WIGS MASKS,10/1/2005,-0.256232543929779 CHILD HATS, WIGS MASKS,11/1/2005,1.83452602676812 CHILD HATS, WIGS MASKS,12/1/2005,-1.06869719416837 CHILD HATS, WIGS MASKS,1/1/2006,1.04378655286183 CHILD HATS, WIGS MASKS,2/1/2006,0.232655831328322 CHILD HATS, WIGS MASKS,3/1/2006,-0.939084802643773 CHILD HATS, WIGS MASKS,4/1/2006,0.854132879285335 CHILD HATS, WIGS MASKS,5/1/2006,-1.71217066877156 CHILD HATS, WIGS MASKS,6/1/2006,1.28040273099582 CHILD HATS, WIGS MASKS,7/1/2006,-0.386415431325857 CHILD HATS, WIGS MASKS,8/1/2006,-0.769127669783483 CHILD HATS, WIGS MASKS,9/1/2006,-0.810996835089867 CHILD HATS, WIGS MASKS,10/1/2006,0.0477292147635991 CHILD HATS, WIGS MASKS,11/1/2006,0.294672848750557 CHILD HATS, WIGS MASKS,12/1/2006,-0.0841330473924862 CHILD HATS, WIGS MASKS,1/1/2007,0.231663729192233 CHILD HATS, WIGS MASKS,2/1/2007,-0.601790650547443 CHILD HATS, WIGS MASKS,3/1/2007,0.285635768516625 CHILD HATS, WIGS MASKS,4/1/2007,-0.963154959558619 CHILD HATS, WIGS MASKS,5/1/2007,1.52188112949994 CHILD HATS, WIGS MASKS,6/1/2007,-0.826092842933196 CHILD HATS, WIGS MASKS,7/1/2007,1.91937201229077 CHILD HATS, WIGS MASKS,8/1/2007,-0.317789483136924 CHILD HATS, WIGS MASKS,9/1/2007,-0.865011007394312 CHILD HATS, WIGS MASKS,10/1/2007,-0.0281604973711276 CHILD HATS, WIGS MASKS,11/1/2007,-0.123887049811822 CHILD HATS, WIGS MASKS,12/1/2007,-0.0327727730592468 CHILD HATS, WIGS MASKS,1/1/2008,-0.0654939600771254 CHILD HATS, WIGS MASKS,2/1/2008,0.279247739913908 CHILD HATS, WIGS MASKS,3/1/2008,0.167606602923418 CHILD HATS, WIGS MASKS,4/1/2008,0.189533097427477 CHILD HATS, WIGS MASKS,5/1/2008,0.402062194225847 CHILD HATS, WIGS MASKS,6/1/2008,1.97150984262995 CHILD HATS, WIGS MASKS,7/1/2008,-2.27538477532968 CHILD HATS, WIGS MASKS,8/1/2008,1.89091792097945 CHILD HATS, WIGS MASKS,9/1/2008,0.0251732151287081 CHILD HATS, WIGS MASKS,10/1/2008,-0.2349741808124 CHILD HATS, WIGS MASKS,11/1/2008,-0.659332058368173 CHILD HATS, WIGS MASKS,12/1/2008,0.127284768034285 CHILD HATS, WIGS MASKS,1/1/2009,-1.42838560676513 CHILD HATS, WIGS MASKS,2/1/2009,0.617689775286461 CHILD HATS, WIGS MASKS,3/1/2009,-0.034243005247084 CHILD HATS, WIGS MASKS,4/1/2009,-0.304574261133836 CHILD HATS, WIGS MASKS,5/1/2009,0.128679369916751 CHILD HATS, WIGS MASKS,6/1/2009,-0.657479389968652 CHILD HATS, WIGS MASKS,7/1/2009,0.608766068692517 CHILD HATS, WIGS MASKS,8/1/2009,1.92814770869400 CHILD HATS, WIGS MASKS,9/1/2009,-0.172644961366165 CHILD HATS, WIGS MASKS,10/1/2009,-0.453255508263169 CHILD HATS, WIGS MASKS,11/1/2009,-1.09903330959344 __ R-help@r-project.org 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@r-project.org 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] Again on overlaying plots (a plot region within a plot region)
Hi Ottorino-Luca, I'm not sure how flexible the layout command is off the top of my head. I have never seen an example of what you describe using layout, so I will assume it can't be done. One option is to use grid and lattice. This is possibly the best option if you are planning to do a lot of this sort of thing. Another option is to plot the second plot, on top of the first plot, using primitives such as points and lines, transforming your coordinates so that they match the coordinates of the first plot. This will be very difficult if you wish to put titles and axis on the nested plot, however simple if you restrict yourself to points and lines. Finding documentation and examples of R's graphical primitives should be easy. At the risk of sounding crude, I'm pretty sure both latex and many word processors allow one position one figure on top of another. This would seem the simplest solution for a one off job. Further to my post on R-devel, I recommend not using png format, except where absolutely necessary. regards -- Charlotte Maia http://sites.google.com/site/maiagx/home __ R-help@r-project.org 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 script From PHP
I tried calling R from a shell script and it works. This is an example file rscript.sh R --no-save EOT x-2*pi print(cbind(x,sin(x))) quit(no) EOT This works perfectly on the Linux machine in which I have logged in via SSH using the command (./rscript.sh) I tried running this command using php html ?php $output = array(); $$retval = 0; $a = shell_exec('./rscript.sh'. 21); //print phpinfo(); print $a; ? /html this does not work and gives me this error: ./rscript.sh: line 1: R: command not found Anybody familiar with this? On Tue, Dec 1, 2009 at 5:35 PM, Romain Francois romain.franc...@dbmail.comwrote: On 12/01/2009 12:48 PM, Hrishi Mittal wrote: Hi Amrit, I believe you can you use the PHP system command to call Rscript or R CMD. I don't know much PHP but this page might be useful - http://php.net/manual/en/function.system.php. You might also want to look at rapache - http://biostat.mc.vanderbilt.edu/rapache/ Good luck with your project and do post a link to your webpage when you get it running. There is also a simple php client to Rserve in the next version of Rserve. http://www.rforge.net/Rserve/index.html -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/FtUu : new package : highlight |- http://tr.im/EAD5 : LondonR slides `- http://tr.im/BcPw : celebrating R commit #5 [[alternative HTML version deleted]] __ R-help@r-project.org 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] Problem with Cannot compute correct p-values with ties
On Wed, 02 Dec 2009 16:52:23 +0800 Zhijiang Wang ivoryto...@emails.bjut.edu.cn wrote: Dear All, 1. why did the problem happen? 2. How to solve it? A good start would be to follow the advice at the bottom of every posting on this mailing list: PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Karl Ove Hufthammer __ R-help@r-project.org 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] RWeka problem with WrapperSubsetEval
Dear all, I am trying to construct a wrapper that uses random forest to evaluate the subsets using RWeka and when I do: nombi - make_Weka_filter(weka/attributeSelection/WrapperSubsetEval) datbin- nombi(gene ~., data=X1X2X3X4W, control =Weka_control( B = list(weka.classifiers.trees.RandomForest))) I also have tried with an other induction algorithm: datbin- nombi(gene ~., data=X1X2X3X4W, control =Weka_control( B=list(weka.classifiers.trees.j48.J48 -F 5 -T 0.01 -S 1 -- -C 0.25 -M 2))) and in both cases I get the following error: Error in .jcall(filter, Z, setInputFormat, instances) : method setInputFormat with signature (Lweka/core/Instances;)Z not found Thanks in advance, Itziar Frades This e-mail is from CIC bioGUNE. The e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any unauthorised dissemination or copying of this e-mail or its attachments, and any use or disclosure of any information contained in them, is strictly prohibited and may be illegal. If you have received this e-mail in error, please notify or telephone + 34 944 06 13 00 and delete it from your system. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Problem with Cannot compute correct p-values with ties
Please try to find answers by yourself You should not just post problems without thinking them. Huang, Guo-Hao -- From: Zhijiang Wang ivoryto...@emails.bjut.edu.cn Sent: Wednesday, December 02, 2009 4:52 PM To: R-help@r-project.org Subject: [R] Problem with Cannot compute correct p-values with ties Dear All, 1. why did the problem happen? 2. How to solve it? -- Best wishes, Zhijiang Wang PHD Student Room 212, Science buliding, The International WIC Institute, College of Computer Science and Technology, Beijing University of Technology, Beijing, China. __ R-help@r-project.org 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@r-project.org 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: adding information on number of observations
Depends on exactly how / where you want to display the text. One approach (showing text inside each panel, at the bottom): bwplot(val ~ grp | panvar, data = dat, panel = function(x, y, ...) { panel.bwplot(x, y, ...) nn - table(x) panel.text(paste(n =, nn), x = seq_along(nn), y = current.panel.limits()$y[1], pos = 3) }) 2009/12/2 RINNER Heinrich heinrich.rin...@tirol.gv.at: Dear R-users, I am using R version 2.9.1 and lattice 0.17-26 under windows. In a lattice boxplot, I would like to add information on how many observations each singel boxplot is based upon. For example (the basic plot): # Begin R-code library(lattice) dat - data.frame(panvar = rep(c(A,B,A,B), c(3,7,4,6)), grp = rep(c(grp1, grp2), c(10,10)), val = rnorm(20)) dat bwplot(val ~ grp | panvar, data = dat) # End R-code As in my real life data the number of observations in each subgroup will be quite different, I would like to include the number of observations each boxplot is based upon. Aggregation will tell me the numbers: # Begin R-code aggregate(dat$val, by = list(dat$panvar, dat$grp), FUN = length) # End R-code But how to match these numbers with the plot (so that for example n=3 will be written as text beneath panel A/group1)? Any advice would be appreciated; kind regards Heinrich. __ R-help@r-project.org 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. -- Felix Andrews / 安福立 Postdoctoral Fellow Integrated Catchment Assessment and Management (iCAM) Centre Fenner School of Environment and Society [Bldg 48a] The Australian National University Canberra ACT 0200 Australia M: +61 410 400 963 T: + 61 2 6125 4670 E: felix.andr...@anu.edu.au CRICOS Provider No. 00120C -- http://www.neurofractal.org/felix/ __ R-help@r-project.org 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] Is R-2.10.0 released already
On 01/12/2009 9:19 PM, Hiroto Miyoshi wrote: Dear R users, and Dr. Delagard I got an R-announce message which tells that R-2.10.0 will be released on December 4, 2009. Could you post a copy of that message? The message I saw said This is to announce that we plan to release R version 2.10.1 on Monday, December 14, 2009. which has a couple of differences from what you describe. Duncan Murdoch Houever, it seems the R of that version was already released. At leased I made sure that the R of that version was in Cran and Univ. of Tsukuba, and also Univ. of Toronto. And that version is quite odd because each package is in a folder whih is named coffin. I am seriously worrying that Cran site is hacked and someone might have placed a mallicious version. Please do take a look at the version and make sure if it is really a valid version. Sincerely Hiroto __ R-help@r-project.org 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 script From PHP
On 12/02/2009 10:43 AM, Amrit Nandan wrote: I tried calling R from a shell script and it works. This is an example file rscript.sh R --no-save EOT x-2*pi print(cbind(x,sin(x))) quit(no) EOT This works perfectly on the Linux machine in which I have logged in via SSH using the command (./rscript.sh) I tried running this command using php html ?php $output = array(); $$retval = 0; $a = shell_exec('./rscript.sh'. 21); //print phpinfo(); print $a; ? /html this does not work and gives me this error: ./rscript.sh: line 1: R: command not found Maybe shell_exec('sh ./rscript.sh 21' ) instead, maybe you need to have the full path of R. With this design, you are going to start a new R session each time you want anything to be computed, and you are going to have to format the result of the R code as a string and parse this string back in php. You really should look into Rserve and its new php client, which I think will solve all of these problems at once. Just download the version 0.6-1 from here : http://www.rforge.net/Rserve/files/ $ wget http://www.rforge.net/src/contrib/Rserve_0.6-1.tar.gz # R CMD INSTALL Rserve_0.6-1.tar.gz start the server $ R CMD Rserve grab the php client, and include it into your php application $ tar zxvf Rserve_0.6-1.tar.gz $ less Rserve/src/client/php/simple.php If you try this route, be aware that the php client is very new. also you probably want to post questions regarding it on this mailing list : http://mailman.rz.uni-augsburg.de/mailman/listinfo/stats-rosuda-devel Romain Anybody familiar with this? On Tue, Dec 1, 2009 at 5:35 PM, Romain Francois romain.franc...@dbmail.com mailto:romain.franc...@dbmail.com wrote: On 12/01/2009 12:48 PM, Hrishi Mittal wrote: Hi Amrit, I believe you can you use the PHP system command to call Rscript or R CMD. I don't know much PHP but this page might be useful - http://php.net/manual/en/function.system.php. You might also want to look at rapache - http://biostat.mc.vanderbilt.edu/rapache/ Good luck with your project and do post a link to your webpage when you get it running. There is also a simple php client to Rserve in the next version of Rserve. http://www.rforge.net/Rserve/index.html -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/FtUu : new package : highlight |- http://tr.im/EAD5 : LondonR slides `- http://tr.im/BcPw : celebrating R commit #5 __ R-help@r-project.org 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] Is R-2.10.0 released already
Duncan Murdoch wrote: On 01/12/2009 9:19 PM, Hiroto Miyoshi wrote: Dear R users, and Dr. Delagard I got an R-announce message which tells that R-2.10.0 will be released on December 4, 2009. Could you post a copy of that message? The message I saw said This is to announce that we plan to release R version 2.10.1 on Monday, December 14, 2009. which has a couple of differences from what you describe. There's an informal tradition that those announcements contain at least one mistake, but apparently I forgot this time, so users have to make up their own -pd -- 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 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org 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] Joint density kde2d works improperly?
Dear all, Please, look at the following code: attach(geyser) f1 - kde2d(duration, waiting, n = 5) a - 0 for (i in 1:5){ for (j in 1:5){ a - a + f1$z[i,j] } } As far as I understood from Help kde2d returns matrix elements of which are values of joint probability mass function Pr(X=x,Y=y) therefore, sum of its elements should sum to 1. Which is not the case from my check. Where is the problem here? Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Replying to Posts Within Same Thread
On 01/12/2009 9:48 PM, Charlotte Maia wrote: Hi, When I reply to a post, it generally appears as a separate thread, rather than branching off the original post. Anyone know what I'm doing wrong? Individual messages have a Message-ID header; for example, your message has this one: Message-ID: b7bfe54e0912011848n130c22a6g8d7da8c4ca505...@mail.gmail.com Your mail client (or the archive one) performs threading based on clues in the header, including ones like References: 4b15931602cb00056...@medicine.umaryland.edu 4b15931702cb00056...@medicine.umaryland.edu 4b15931702cb00056...@medicine.umaryland.edu and In-Reply-To: 4b15931702cb00056...@medicine.umaryland.edu (from a different message). Your problem is that because you are using the digest, you aren't inserting those headers (or perhaps yours refer to the digest, not the individual message), so the clients don't realize your messages are replies. There may be ways to trigger the threading without knowing the message ID, because sometimes message IDs in References are not right. For example, the References list that I posted was from John Sorkin's reply to you, which my client correctly threaded even though it refers to a different message ID than yours (presumably something local to his system). Duncan Murdoch Noting I am currently receiving a couple of the lists in digest form. kind regards __ R-help@r-project.org 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 script From PHP
RServe looks exciting but the problem is that I am not sure whether I would be allowed to install anything on the linux server on which I am working. On Wed, Dec 2, 2009 at 3:40 PM, Romain Francois romain.franc...@dbmail.comwrote: On 12/02/2009 10:43 AM, Amrit Nandan wrote: I tried calling R from a shell script and it works. This is an example file rscript.sh R --no-save EOT x-2*pi print(cbind(x,sin(x))) quit(no) EOT This works perfectly on the Linux machine in which I have logged in via SSH using the command (./rscript.sh) I tried running this command using php html ?php $output = array(); $$retval = 0; $a = shell_exec('./rscript.sh'. 21); //print phpinfo(); print $a; ? /html this does not work and gives me this error: ./rscript.sh: line 1: R: command not found Maybe shell_exec('sh ./rscript.sh 21' ) instead, maybe you need to have the full path of R. With this design, you are going to start a new R session each time you want anything to be computed, and you are going to have to format the result of the R code as a string and parse this string back in php. You really should look into Rserve and its new php client, which I think will solve all of these problems at once. Just download the version 0.6-1 from here : http://www.rforge.net/Rserve/files/ $ wget http://www.rforge.net/src/contrib/Rserve_0.6-1.tar.gz # R CMD INSTALL Rserve_0.6-1.tar.gz start the server $ R CMD Rserve grab the php client, and include it into your php application $ tar zxvf Rserve_0.6-1.tar.gz $ less Rserve/src/client/php/simple.php If you try this route, be aware that the php client is very new. also you probably want to post questions regarding it on this mailing list : http://mailman.rz.uni-augsburg.de/mailman/listinfo/stats-rosuda-devel Romain Anybody familiar with this? On Tue, Dec 1, 2009 at 5:35 PM, Romain Francois romain.franc...@dbmail.com mailto:romain.franc...@dbmail.com wrote: On 12/01/2009 12:48 PM, Hrishi Mittal wrote: Hi Amrit, I believe you can you use the PHP system command to call Rscript or R CMD. I don't know much PHP but this page might be useful - http://php.net/manual/en/function.system.php. You might also want to look at rapache - http://biostat.mc.vanderbilt.edu/rapache/ Good luck with your project and do post a link to your webpage when you get it running. There is also a simple php client to Rserve in the next version of Rserve. http://www.rforge.net/Rserve/index.html -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/FtUu : new package : highlight |- http://tr.im/EAD5 : LondonR slides `- http://tr.im/BcPw : celebrating R commit #5 [[alternative HTML version deleted]] __ R-help@r-project.org 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 script From PHP
Also I tried out your method, it returns the same error. Another thing, If I change the top line in rscript.sh to R --slave it just gives me a neat output. I am not sure why running the shell script directly from within the same folder is working where as from php it is not recognising R command. On Wed, Dec 2, 2009 at 3:47 PM, Amrit Nandan amrit.nan...@gmail.com wrote: RServe looks exciting but the problem is that I am not sure whether I would be allowed to install anything on the linux server on which I am working. On Wed, Dec 2, 2009 at 3:40 PM, Romain Francois romain.franc...@dbmail.com wrote: On 12/02/2009 10:43 AM, Amrit Nandan wrote: I tried calling R from a shell script and it works. This is an example file rscript.sh R --no-save EOT x-2*pi print(cbind(x,sin(x))) quit(no) EOT This works perfectly on the Linux machine in which I have logged in via SSH using the command (./rscript.sh) I tried running this command using php html ?php $output = array(); $$retval = 0; $a = shell_exec('./rscript.sh'. 21); //print phpinfo(); print $a; ? /html this does not work and gives me this error: ./rscript.sh: line 1: R: command not found Maybe shell_exec('sh ./rscript.sh 21' ) instead, maybe you need to have the full path of R. With this design, you are going to start a new R session each time you want anything to be computed, and you are going to have to format the result of the R code as a string and parse this string back in php. You really should look into Rserve and its new php client, which I think will solve all of these problems at once. Just download the version 0.6-1 from here : http://www.rforge.net/Rserve/files/ $ wget http://www.rforge.net/src/contrib/Rserve_0.6-1.tar.gz # R CMD INSTALL Rserve_0.6-1.tar.gz start the server $ R CMD Rserve grab the php client, and include it into your php application $ tar zxvf Rserve_0.6-1.tar.gz $ less Rserve/src/client/php/simple.php If you try this route, be aware that the php client is very new. also you probably want to post questions regarding it on this mailing list : http://mailman.rz.uni-augsburg.de/mailman/listinfo/stats-rosuda-devel Romain Anybody familiar with this? On Tue, Dec 1, 2009 at 5:35 PM, Romain Francois romain.franc...@dbmail.com mailto:romain.franc...@dbmail.com wrote: On 12/01/2009 12:48 PM, Hrishi Mittal wrote: Hi Amrit, I believe you can you use the PHP system command to call Rscript or R CMD. I don't know much PHP but this page might be useful - http://php.net/manual/en/function.system.php. You might also want to look at rapache - http://biostat.mc.vanderbilt.edu/rapache/ Good luck with your project and do post a link to your webpage when you get it running. There is also a simple php client to Rserve in the next version of Rserve. http://www.rforge.net/Rserve/index.html -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/FtUu : new package : highlight |- http://tr.im/EAD5 : LondonR slides `- http://tr.im/BcPw : celebrating R commit #5 [[alternative HTML version deleted]] __ R-help@r-project.org 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] Replying to Posts Within Same Thread
Charlotte Maia wrote: On 12/2/09, John Sorkin jsor...@grecc.umaryland.edu wrote: I don't know what you are doing wrong because I don't know exactly what you are doing. I do know that I don't have your problem when I simply reply to a message without touching the subject line. John Could you clarify the notion of simply reply. There is no obvious reply links in either the archive page, or the digest. In the case, where someone sends me an email, such have you have done, I can simply reply. However, in general this option is not available. Things look normal from here; e.g., the above is threaded as a child of Sorkin's mail, and it has the appropriate In-Reply-To: 4b15931702cb00056...@medicine.umaryland.edu header. I.e., I suspect that your own mail client may be doing you in. (Some mail clients, like Thunderbird, will even thread on the text of the Subject field, which can be a bit of a pain when people choose unoriginal subjects like Question.) -- 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 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org 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] Calling R (GNU R) functions from Common Lisp, how?
Hi Lisp users, I'm a user of both Common Lisp and R (GNU R). I found R has a rich collection of statistical and numerical computation functions, while it is not as extensible as Lisp (Common Lisp). I considered Lisp-Stat but its only implementation is not in the usuall Common Lisp, and the available functions in CRAN are far richer than Lisp-Stat currently has. I want to know if there is already an existing way of calling R functions from within Common Lisp? If no, please point me to relevant resources so that I can create one (that works in a platform-independent manner). Best, tjw __ R-help@r-project.org 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 script From PHP
Some more development: I found the directory of R in the Root It is /usr/bin/R I did a ls -l R and got this output -rwxr-xr-x 1 root root 6642 Jan 9 2006 R (This looks like in CHMOD 755 already) So I modified my shell script #!/bin/sh cd /usr/bin/ pwd R --slave EOF x-2*pi print(cbind(x,sin(x))) quit(no) EOF This is returning me the same error when I try to execute it via my PHP shell_exec('./rscript.sh'. 21); Error: /usr/bin ./rscript.sh: line 4: R: command not found This is really wierd. On Wed, Dec 2, 2009 at 3:52 PM, Amrit Nandan amrit.nan...@gmail.com wrote: Also I tried out your method, it returns the same error. Another thing, If I change the top line in rscript.sh to R --slave it just gives me a neat output. I am not sure why running the shell script directly from within the same folder is working where as from php it is not recognising R command. On Wed, Dec 2, 2009 at 3:47 PM, Amrit Nandan amrit.nan...@gmail.comwrote: RServe looks exciting but the problem is that I am not sure whether I would be allowed to install anything on the linux server on which I am working. On Wed, Dec 2, 2009 at 3:40 PM, Romain Francois romain.franc...@dbmail.com wrote: On 12/02/2009 10:43 AM, Amrit Nandan wrote: I tried calling R from a shell script and it works. This is an example file rscript.sh R --no-save EOT x-2*pi print(cbind(x,sin(x))) quit(no) EOT This works perfectly on the Linux machine in which I have logged in via SSH using the command (./rscript.sh) I tried running this command using php html ?php $output = array(); $$retval = 0; $a = shell_exec('./rscript.sh'. 21); //print phpinfo(); print $a; ? /html this does not work and gives me this error: ./rscript.sh: line 1: R: command not found Maybe shell_exec('sh ./rscript.sh 21' ) instead, maybe you need to have the full path of R. With this design, you are going to start a new R session each time you want anything to be computed, and you are going to have to format the result of the R code as a string and parse this string back in php. You really should look into Rserve and its new php client, which I think will solve all of these problems at once. Just download the version 0.6-1 from here : http://www.rforge.net/Rserve/files/ $ wget http://www.rforge.net/src/contrib/Rserve_0.6-1.tar.gz # R CMD INSTALL Rserve_0.6-1.tar.gz start the server $ R CMD Rserve grab the php client, and include it into your php application $ tar zxvf Rserve_0.6-1.tar.gz $ less Rserve/src/client/php/simple.php If you try this route, be aware that the php client is very new. also you probably want to post questions regarding it on this mailing list : http://mailman.rz.uni-augsburg.de/mailman/listinfo/stats-rosuda-devel Romain Anybody familiar with this? On Tue, Dec 1, 2009 at 5:35 PM, Romain Francois romain.franc...@dbmail.com mailto:romain.franc...@dbmail.com wrote: On 12/01/2009 12:48 PM, Hrishi Mittal wrote: Hi Amrit, I believe you can you use the PHP system command to call Rscript or R CMD. I don't know much PHP but this page might be useful - http://php.net/manual/en/function.system.php. You might also want to look at rapache - http://biostat.mc.vanderbilt.edu/rapache/ Good luck with your project and do post a link to your webpage when you get it running. There is also a simple php client to Rserve in the next version of Rserve. http://www.rforge.net/Rserve/index.html -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/FtUu : new package : highlight |- http://tr.im/EAD5 : LondonR slides `- http://tr.im/BcPw : celebrating R commit #5 [[alternative HTML version deleted]] __ R-help@r-project.org 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 script From PHP
I agree with Romain that you should probably try and get Rserve to work as that is a much better way. However, to get your commandline version working, I suggest you use the Rscript comman instead of a bash script. So let's say you save your R script as a myscript.R file. Then do: shell_exec('Rscript /path/to/myscript.R'. 21); If that still gives you an error like Rscript command not found, then you need to make sure your R bin directory is added to the PATH system variable. -- View this message in context: http://n4.nabble.com/R-script-From-PHP-tp931996p932992.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Calling R (GNU R) functions from Common Lisp, how?
RCL looks promising - http://common-lisp.net/project/rcl/ For quick and short calls to R, you can always use the system commands in CL to call R CMD or Rscript. tsunhin wong wrote: Hi Lisp users, I'm a user of both Common Lisp and R (GNU R). I found R has a rich collection of statistical and numerical computation functions, while it is not as extensible as Lisp (Common Lisp). I considered Lisp-Stat but its only implementation is not in the usuall Common Lisp, and the available functions in CRAN are far richer than Lisp-Stat currently has. I want to know if there is already an existing way of calling R functions from within Common Lisp? If no, please point me to relevant resources so that I can create one (that works in a platform-independent manner). Best, tjw __ R-help@r-project.org 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. -- View this message in context: http://n4.nabble.com/Calling-R-GNU-R-functions-from-Common-Lisp-how-tp932953p932994.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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 Batch Mode Customized Input
Dear all, I use R in Batch Mode with the following syntax: X:\...\Rcmd BATCH --slave X\...\test.R X:\...\Log.txt It works very fine. Now I want to write a function and customize the input for my R-File, e.g I want to define the start and the end date. Let's assume that test.R includes only a function like this: analysis-function(start.date,end.date){...} Is it possible to give the arguments of the function via Batch Mode, e.g. start.date=c(2009-10-01) and end.date=c(2009-10-31)? Normally I would do this as following: result-analysis(c(2009-10-01),c(2009-10-31)). Going away from the function: It were sufficent, if the R-Script test.R were running and recognizing start.date and end.date in the same manner as I would write the dates in the top of the file. The background: I am searching for a possibility, that my colleagues can use my files without programming skills in R and without the necessity of opening R. The batch mode is a great thing at this point - the actual problem for me is the missing possibility of define some details. Have you any suggestions to solve my problem? Probably there are other possibilities I don't see at the moment. If other people could enter the dates in the example (in which way respectively in which platform is to define) and start the R-File without R-knowledge, in whatever way, this were the optimal solution. Thank you very much in advance, Jens. -- View this message in context: http://n4.nabble.com/R-Batch-Mode-Customized-Input-tp932947p932947.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] pictures_in_a_matrix
Dear all, how is it possible to upload first two figures (original: jpeg files, these are two pictures from a micrope) in a layout(matrix(c(1,2,3), 1,3), widths=c(2.5,1.5, 2.5), heights=c(1,1) ) (the last field of the matrix is for a barplot)? The hole matrix is then need to be safed as eps-format. Does it make sense to upload these figures in R? Many thanks for any help! Claudia. -- * Dr. Claudia Hantschel Züchtungsbiologie und Molekulare Genetik Department für Nutzpflanzen- und Tierwissenschaften Humboldt-Universität zu Berlin Invalidenstraße 42 10115 Berlin Breeding Biology and Molecular Genetics Department for Crop and Animal Sciences Humboldt-University of Berlin Invalidenstraße 42 10115 Berlin Germany phone: 0049 30 2093 6304 fax: 0049 30 2093 6397 __ R-help@r-project.org 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] Replying to Posts Within Same Thread
To be honest, I've never figured this out either. However, if you're familiar with the gmail way of threading emails, just bookmark and use google groups: http://groups.google.co.uk/group/r-help-archive It's the easiest way I've personally found, and has a very intuitive interface. HTH, Tony Breyal On 2 Dec, 03:42, Charlotte Maia mai...@gmail.com wrote: On 12/2/09, John Sorkin jsor...@grecc.umaryland.edu wrote: I don't know what you are doing wrong because I don't know exactly what you are doing. I do know that I don't have your problem when I simply reply to a message without touching the subject line. John Could you clarify the notion of simply reply. There is no obvious reply links in either the archive page, or the digest. In the case, where someone sends me an email, such have you have done, I can simply reply. However, in general this option is not available. -- Charlotte Maiahttp://sites.google.com/site/maiagx/home __ r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org 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] Histogram probabilities 1 ????!!!
Hi everybody, well, I definitely don't understand anything. Why the hist function with freq=FALSE gives such a strange result??? R - c(-1.10, 0.79, -1.17, -0.53, -0.26, -0.22, 0.29, -0.26, -0.26, 0.39) hist(R, freq=FALSE, breaks=10) Thanks everybody [[alternative HTML version deleted]] __ R-help@r-project.org 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] Replying to Posts Within Same Thread
I use Nabble which it has a reply button and seems to work fine. The old version was very slow but the new one is fast. Peter Dalgaard wrote: Charlotte Maia wrote: On 12/2/09, John Sorkin jsor...@grecc.umaryland.edu wrote: I don't know what you are doing wrong because I don't know exactly what you are doing. I do know that I don't have your problem when I simply reply to a message without touching the subject line. John Could you clarify the notion of simply reply. There is no obvious reply links in either the archive page, or the digest. In the case, where someone sends me an email, such have you have done, I can simply reply. However, in general this option is not available. Things look normal from here; e.g., the above is threaded as a child of Sorkin's mail, and it has the appropriate In-Reply-To: 4b15931702cb00056...@medicine.umaryland.edu header. I.e., I suspect that your own mail client may be doing you in. (Some mail clients, like Thunderbird, will even thread on the text of the Subject field, which can be a bit of a pain when people choose unoriginal subjects like Question.) -- 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 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org 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. -- View this message in context: http://n4.nabble.com/Replying-to-Posts-Within-Same-Thread-tp932713p932995.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Histogram probabilities 1 ????!!!
Trafim rdapam...@gmail.com wrote well, I definitely don't understand anything. Why the hist function with freq=FALSE gives such a strange result??? R - c(-1.10, 0.79, -1.17, -0.53, -0.26, -0.22, 0.29, -0.26, -0.26, 0.39) hist(R, freq=FALSE, breaks=10) The total AREA has to equal 1, which does not mean that the highest height has to be less than 1. It looks like each of your bars is about .2 wide; area = height*width, so that high one in the middle has area of about 2*.2 = .4 HTH Peter Peter L. Flom, PhD Statistical Consultant Website: www DOT peterflomconsulting DOT com Writing; http://www.associatedcontent.com/user/582880/peter_flom.html Twitter: @peterflom __ R-help@r-project.org 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] Replying to Posts Within Same Thread
I hit the reply all button on my Email client if I want the message to go both to the person who wrote the Email and the R listserver. John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Charlotte Maia mai...@gmail.com 12/1/2009 10:42 PM On 12/2/09, John Sorkin jsor...@grecc.umaryland.edu wrote: I don't know what you are doing wrong because I don't know exactly what you are doing. I do know that I don't have your problem when I simply reply to a message without touching the subject line. John Could you clarify the notion of simply reply. There is no obvious reply links in either the archive page, or the digest. In the case, where someone sends me an email, such have you have done, I can simply reply. However, in general this option is not available. -- Charlotte Maia http://sites.google.com/site/maiagx/home __ R-help@r-project.org 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. Confidentiality Statement: This email message, including any attachments, is for th...{{dropped:6}} __ R-help@r-project.org 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] Histogram probabilities 1 ????!!!
Y-axis in your code is ``Counts'' irrelevant to probabilities. Guo-Hao Huang -- From: Trafim rdapam...@gmail.com Sent: Wednesday, December 02, 2009 7:35 PM To: r-help@r-project.org Subject: [R] Histogram probabilities 1 !!! Hi everybody, well, I definitely don't understand anything. Why the hist function with freq=FALSE gives such a strange result??? R - c(-1.10, 0.79, -1.17, -0.53, -0.26, -0.22, 0.29, -0.26, -0.26, 0.39) hist(R, freq=FALSE, breaks=10) Thanks everybody [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] Normal tests disagree?
On 01-Dec-09 23:11:20, rkevinbur...@charter.net wrote: If I have data that I feed into shapio.test and jarque.bera.test yet they seem to disagree. What do I use for a decision? For my data set I have p.value of 0.05496421 returned from the shapiro.test and 0.882027 returned from the jarque.bera.test. I have included the data set below. Thank you. Kevin [Data snipped] The reason is that the Jarque-Bera test (JB) works with the squared skewness plus 1/4 of (kurtosis - 3)^2. For a Normal distribution, the skewness is zero and the kurtosis is 3. Hence large values of JB are evidence against the hypothesis that the distribution is Normal, in the basis that skewness and/or kurtosis depart from the values to be expected for a Normal distribution. However, it is perfectly possible to get skewness near 0, and kurtosis near 3, for manifestly non-Normal distributions. I get Skewness=0.014 and Kurtosis=3.32 for your data, both quite close to the Normal values. However, you only have to look at the histogram to see that the distribution has a distinctly non-Normal appearance: hist(x,breaks=20) The Shapiro-Wilk test, on the other hand, works (broadly speaking) in terms of standardised spacings between the order statistics of the sample, compared with what they should be from a Normal. It is therefore sensitive to features of the sample which are rather different to the features that the J-B test is sensitive to. Given the appearance of the histogram, it is to be expected that many of the spacings between order statistics are different from what are to be expected from a Normal distribution. Much of this, and also the insensitivity of the J-B test, arises from the clump of values at the top of the range (6 out of the 59 between 1.83 and 2.00). Leave these out and you get quite different results. The following is an explicit implementation of the J-B test, based on the Wikipedia description, and using the chi-squared(2) approximation for the P-value (and also returning the skewness and kurtosis): jarque.bera - function(x){ m1 - mean(x); m2 - mean((x-m1)^2) m3 - mean((x-m1)^3) ; m4 - mean((x-m1)^4) n - length(x) ; S - m3/(m2^(3/2)) ; K - m4/(m2^2) JB - (n/6)*(S^2 + ((K-3)^2)/4) P - 1-pchisq(JB,2) list(JB=JB,P=P,S=S,K=K) } For your original data x (as explicitly extracted by Ben Bolker): jarque.bera(x) # $JB # [1] 0.251065 # $P # [1] 0.882027 # (As you found yourself) # $S # [1] 0.01396711 # $K # [1] 3.318352 For the data excluding the 6 values above 1.83: jarque.bera(x[x=1.83]) # $JB # [1] 6.047885 # $P # [1] 0.04860919 # $S # [1] -0.6831185 # $K # [1] 3.933842 So excluding these values has produced a distinct negative skewness and a kurtosis distinctly greater than 3. Hence those 6 values were primarily responsible for almost completely eliminating the skewness and the kurtosis of the remainder of the distribution, and hence frustrating the J-B test. Now compare with the Shapiro-Wilk test: shapiro.test(x) # Shapiro-Wilk normality test # data: x # W = 0.9608, p-value = 0.05496 so the S-W P-value 0.05496 for the full data is close to the J-B P-value 0.04861 for the reduced data. Now compare with the S-W test on the reduced data: shapiro.test(x[x = 1.83]) # Shapiro-Wilk normality test # data: x[x = 1.83] # W = 0.9595, p-value = 0.06968 The S-W P-vale has increased slightly (from 0.055 to 0.070), but the S-W test is still picking up the non-Normality in the reduced dataset. The summary is that the S-W test and the J-B test are looking at different aspects of the data. The J-B test depends only on two summary functions (skewness and kurtosis) as indices of non-Normality, while the S-W test is sensitive to a wider variation of the fine detail of the distribution of the data. The failure of the J-B test to detect the non-Normality in the data is primarily due to the fact that the 6 data values at the top end have, in effect, compensated for the marked skewness and kurtosis in the remainder of the data. The ultimate lesson from all this is that different tests test for different kinds of deperture from the Null Hypothesis. See also Uwe Ligges's remarks ... Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 02-Dec-09 Time: 11:53:22 -- XFMail -- __ R-help@r-project.org 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] problems installing R packages
Hi, I´m trying to install new package in R (version 2.4.0) under windows vista and i have problems. I always receive the same message: Erro en zip.unpack(pkg, tmpDir) : no fue posible abrir el archivo 'C:/Program Files/R/R-2.4.0/library/file2019500d/mprobit/libs/mprobit.dll' It can´t open the file. I check the compatibility with the version and is ok, I have no idea where's the problem cause i'm the administrator and i've enough free space in the hard disc. Anyone could help me -- View this message in context: http://n4.nabble.com/problems-installing-R-packages-tp933010p933010.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] problems installing R packages
Could you install the latest R software in your computer? In R-2.9.2, install.packages(mprobit) works well. Guo-Hao Huang -- From: catuxa-2 catuxa...@gmail.com Sent: Wednesday, December 02, 2009 7:55 PM To: r-help@r-project.org Subject: [R] problems installing R packages Hi, I´m trying to install new package in R (version 2.4.0) under windows vista and i have problems. I always receive the same message: Erro en zip.unpack(pkg, tmpDir) : no fue posible abrir el archivo 'C:/Program Files/R/R-2.4.0/library/file2019500d/mprobit/libs/mprobit.dll' It can´t open the file. I check the compatibility with the version and is ok, I have no idea where's the problem cause i'm the administrator and i've enough free space in the hard disc. Anyone could help me -- View this message in context: http://n4.nabble.com/problems-installing-R-packages-tp933010p933010.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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] category with respect to category
hello I have two categorical data and want to visualise them to see their changes? Which graph do you recommend me for category with respect to category ? kind regards Ahmet Temiz -- Open WebMail Project (http://openwebmail.org) -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. __ R-help@r-project.org 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] explanation for left-side behaviour
Hi Don, thanks for your answer. Okay, I should have mentioned the error messages I get for case 1 and 2 - sorry. I was just surprised because the following does not give an error (though I feed with the factor vector): substr(values,2,3) [1] bc bc bc cd cd cd de de de Obviously, the factor vector is converted to character somewhere, no? I get the same result when typing: substr(as.character(values),2,3) So, the restriction that substr cannot take anything else than a character vector seems to be only in case I want to use the replace functionality instead of just extracting a substring. At least, that is my guess.. Ciao, Antje Don MacQueen wrote: Read the help page for substr(). It says that the first argument should be a character vector. The only one that works is the one where you gave it a character vector. You said only third one works. But you didn't explain what you mean by works. It's always a good idea on r-help to show both what you expected, and what you actually got, so that people can understand exactly what the question is. To explain a little further, let me number your three approaches. [1] substr(values,2,3) - .. [2] substr(as.character(values),2,3) - .. values - as.character(values) [3] substr(values,2,3) - .. With regard to case [1] It makes no sense to replace character substrings in a factor. factors are really numbers, not characters. It's just that they have additional attributes that make them (sometimes) print as if the were characters. But they're not. And the error message (that you didn't report) says exactly that. With regard to case [2]: values and as.character(values) are not the same thing. Therefore, replacing substrings in as.character(values) is not the same as replacing substrings in values. In this case, I would interpret the error message to indicate that R is trying to replace characters in a function. That makes sense, because you supplied a function, namely, as.character(). Case [3] works because you supplied a character vector. -Don At 9:57 AM +0100 12/1/09, Antje wrote: Hi there, I'm pretty sure that it's written down somewhere but I cannot find it so far. The little example shows different approaches to replace a substring. Only the last one works. I think it has something to do with the fact that substr is used on the left side. Can anybody refer to an explanation for this behaviour? Thanks a lot in advance! Antje values - factor(c(rep(abc,3), rep(bcd,3), rep(cde,3))) substr(values,2,3) - .. substr(as.character(values),2,3) - .. values - as.character(values) substr(values,2,3) - .. __ R-help@r-project.org 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@r-project.org 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] problems installing R packages
On 12/02/2009 12:55 PM, catuxa-2 wrote: Hi, I´m trying to install new package in R (version 2.4.0) under windows vista and i have problems. I always receive the same message: Erro en zip.unpack(pkg, tmpDir) : no fue posible abrir el archivo 'C:/Program Files/R/R-2.4.0/library/file2019500d/mprobit/libs/mprobit.dll' It can´t open the file. I check the compatibility with the version and is ok, I have no idea where's the problem cause i'm the administrator and i've enough free space in the hard disc. Anyone could help me Try to time travel back in late 2006 when 2.4.0 was current, or upgrade to the current version of R (2.10.0) for which you might get support ... whichever way is easiest for you. When you are done, please lend us your time travel machine so that we can get R 3.0.0 from the future. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/FtUu : new package : highlight |- http://tr.im/EAD5 : LondonR slides `- http://tr.im/BcPw : celebrating R commit #5 __ R-help@r-project.org 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] Cryptic error message from rfe (in caret package)
When using the function rfe I receive the warning In x == y : longer object length is not a multiple of shorter object length more than 50 times. I call rfe as follows: nbProfile - rfe(features.train.50pct, truth.train.50pct, sizes = no.features, rfeControl = nbCtrl) where features.train.50pct data frame of 8 named columns, each of 487 rows, numeric truth.train.50pct factor of 487 logical elements sizes 1, 2, ..., 8 nbCtrl rfeControl(functions = nbFuncs, method = cv, verbose = F, returnResamp = final) Does anybody know to which objects the warnings refer? Richard R. Liu Dittingerstr. 33 CH-4053 Basel Switzerland Tel.: +41 61 331 10 47 Mobil: +41 79 708 67 66 Email: richard@pueo-owl.ch __ R-help@r-project.org 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 script From PHP
On 12/02/2009 12:30 PM, Hrishi Mittal wrote: I agree with Romain that you should probably try and get Rserve to work as that is a much better way. However, to get your commandline version working, I suggest you use the Rscript comman instead of a bash script. So let's say you save your R script as a myscript.R file. Then do: shell_exec('Rscript /path/to/myscript.R'. 21); If that still gives you an error like Rscript command not found, then you need to make sure your R bin directory is added to the PATH system variable. ... maybe shell_exec('/usr/bin/Rscript /path/to/myscript.R'. 21); -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/FtUu : new package : highlight |- http://tr.im/EAD5 : LondonR slides `- http://tr.im/BcPw : celebrating R commit #5 __ R-help@r-project.org 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] Replying to Posts Within Same Thread
There is an issue which does not seem to have been raised yet in this thread. In her original post, Charlotte Maia said she was receiving messages in Digest form. There are two Digest options: Get MIME or Plain Text Digests? You can choose which one to use, if you opt for Digest format, when setting your subscription options in the R-help configuration page at https://stat.ethz.ch/mailman/options/r-help In a plain-text Digest, all the messages are bundled into a single message. Therefore when you reply to one of these you have to edit out everything except the bit you are replying to; and also the Thread-relevant headers of the original messages will heve been suppressed -- only headers for the Dugest message will be present, and these will have nothing to do with the threads that the separate original messages belonged to. On the other hand, in a MIME Digest, each of the original messages is attached as a separate attachment, along with its original headers. A mail agent which is MIME-Digest-aware will allow the user to open up each attachment separately, as a single message, and reply to that. Then the mail agent *should* incorporate these headers, including those which identify the thread. So, if you use Digest format, choose MIME Digest, and use a mail agent which works properly! Ted. On 02-Dec-09 11:51:32, John Sorkin wrote: I hit the reply all button on my Email client if I want the message to go both to the person who wrote the Email and the R listserver. John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Charlotte Maia mai...@gmail.com 12/1/2009 10:42 PM On 12/2/09, John Sorkin jsor...@grecc.umaryland.edu wrote: I don't know what you are doing wrong because I don't know exactly what you are doing. I do know that I don't have your problem when I simply reply to a message without touching the subject line. John Could you clarify the notion of simply reply. There is no obvious reply links in either the archive page, or the digest. In the case, where someone sends me an email, such have you have done, I can simply reply. However, in general this option is not available. -- Charlotte Maia http://sites.google.com/site/maiagx/home E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 02-Dec-09 Time: 12:15:01 -- XFMail -- __ R-help@r-project.org 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] problems installing R packages
Thank you!!! It was just the run as administrator, sorry But anyway, i can´t change the version because i'm developing a java aplication integraed with R, and the people who configurate te computer recomended me not to change the version. I'm not in love with late 2006! But i think that i need to risk changing it, becaus i'm having lots of problems Do you know something of integrate eclipse and R??? Thank you 2009/12/2 Romain Francois [via R] ml-node+933022-1560375...@n4.nabble.comml-node%2b933022-1560375...@n4.nabble.com On 12/02/2009 12:55 PM, catuxa-2 wrote: Hi, I´m trying to install new package in R (version 2.4.0) under windows vista and i have problems. I always receive the same message: Erro en zip.unpack(pkg, tmpDir) : no fue posible abrir el archivo 'C:/Program Files/R/R-2.4.0/library/file2019500d/mprobit/libs/mprobit.dll' It can´t open the file. I check the compatibility with the version and is ok, I have no idea where's the problem cause i'm the administrator and i've enough free space in the hard disc. Anyone could help me Try to time travel back in late 2006 when 2.4.0 was current, or upgrade to the current version of R (2.10.0) for which you might get support ... whichever way is easiest for you. When you are done, please lend us your time travel machine so that we can get R 3.0.0 from the future. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/FtUu : new package : highlight |- http://tr.im/EAD5 : LondonR slides `- http://tr.im/BcPw : celebrating R commit #5 __ [hidden email]http://n4.nabble.com/user/SendEmail.jtp?type=nodenode=933022i=0mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View message @ http://n4.nabble.com/problems-installing-R-packages-tp933010p933022.html To unsubscribe from problems installing R packages, click here (link removed) ==. -- View this message in context: http://n4.nabble.com/problems-installing-R-packages-tp933010p933030.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org 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] problems installing R packages
R 2.4.0 is obsolete. First update to the latest version (2.10.0, 2.10.1 will be available soon). And then try to install the packages. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner 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 -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens catuxa-2 Verzonden: woensdag 2 december 2009 12:55 Aan: r-help@r-project.org Onderwerp: [R] problems installing R packages Hi, I´m trying to install new package in R (version 2.4.0) under windows vista and i have problems. I always receive the same message: Erro en zip.unpack(pkg, tmpDir) : no fue posible abrir el archivo 'C:/Program Files/R/R-2.4.0/library/file2019500d/mprobit/libs/mprobit.dll' It can´t open the file. I check the compatibility with the version and is ok, I have no idea where's the problem cause i'm the administrator and i've enough free space in the hard disc. Anyone could help me -- View this message in context: http://n4.nabble.com/problems-installing-R-packages-tp933010p933010.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. Druk dit bericht a.u.b. niet onnodig af. Please do not print this message unnecessarily. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document. __ R-help@r-project.org 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] problems installing R packages
I think your keyboard has a punctuation problem. What's with all the exclamation points. On 12/02/2009 01:18 PM, catuxa-2 wrote: Thank you!!! It was just the run as administrator, sorry But anyway, i can´t change the version because i'm developing a java aplication integraed with R, and the people who configurate te computer recomended me not to change the version. Then ask them for support. I'm not in love with late 2006! But i think that i need to risk changing it, becaus i'm having lots of problems Do you know something of integrate eclipse and R??? What do you mean ? Thank you 2009/12/2 Romain Francois [via R] ml-node+933022-1560375...@n4.nabble.comml-node%2b933022-1560375...@n4.nabble.com On 12/02/2009 12:55 PM, catuxa-2 wrote: Hi, I´m trying to install new package in R (version 2.4.0) under windows vista and i have problems. I always receive the same message: Erro en zip.unpack(pkg, tmpDir) : no fue posible abrir el archivo 'C:/Program Files/R/R-2.4.0/library/file2019500d/mprobit/libs/mprobit.dll' It can´t open the file. I check the compatibility with the version and is ok, I have no idea where's the problem cause i'm the administrator and i've enough free space in the hard disc. Anyone could help me Try to time travel back in late 2006 when 2.4.0 was current, or upgrade to the current version of R (2.10.0) for which you might get support ... whichever way is easiest for you. When you are done, please lend us your time travel machine so that we can get R 3.0.0 from the future. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/FtUu : new package : highlight |- http://tr.im/EAD5 : LondonR slides `- http://tr.im/BcPw : celebrating R commit #5 __ R-help@r-project.org 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] polygon graph
Hi all, I have a matrix dd with dates and data. i WANT to create a grpah with shade between the line and the zero axis. I´m trying to use polygon but something doesn´ t work Imagine. I want to plot g-read.table(dd.txt, col.names=c(fecha,DP)) g$fecha - as.Date(g$fecha, format=%d/%m/%Y) t-g$fecha st-length(g$DP) ft-plot(t,g$DP,type=l,ylab=DP) polygon(c(1, 1:st, st), c(0, g$USGDP, 0), col = blue) abline(h = 0, lwd = 1, col = black) If I ommit ploygon line the doc works properly (it plots a graph line). But I want to colur the area below or over the line and the zero axis. Can you guide or indicate because in this case polygon doesn´t work. I attach the two files. Thanks in advance for all. 31/03/1948 12.9 30/06/1948 24.9 30/09/1948 45.6 31/12/1948 24.2 31/03/1949 21.1 30/06/1949 -21.1 30/09/1949 -20.5 31/12/1949 -21.6 31/03/1950 23.8 30/06/1950 27.4 30/09/1950 10.4 31/12/1950 13.4 31/03/1951 10.3 30/06/1951 28.9 30/09/1951 26.8 31/12/1951 25.2 31/03/1952 24.9 30/06/1952 23.3 30/09/1952 22 31/12/1952 25.2 31/03/1953 26.1 30/06/1953 26.7 30/09/1953 25.4 31/12/1953 0.4 31/03/1954 -21.9 30/06/1954 -22.5 30/09/1954 -02.8 31/12/1954 22.8 g-read.table(PIB.txt, col.names=c(fecha,DP), sep=;,dec=,) g$fecha - as.Date(g$fecha, format=%d/%m/%Y) t-g$fecha st-length(g$DP) ft-plot(t,g$DP,type=l,ylab=US GDP, xlab=Tiempo,main=Evolución Histórica PIB US) #polygon(c(1, 1:st, st), c(0, g$DP, 0), col = blue) grid() abline(h = 0, lwd = 1, col = black) __ R-help@r-project.org 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] Incorporating the results of White's HCCM into a linear regression:
Yoseph, What do you mean by 'incorporate into'? If you mean to update the fit object's variance-covariance matrix, one approach might be require(rms) ols1 - ols(uer92 ~ ..., x=TRUE, y=TRUE) ols1 - robcov(ols1) anova(ols1); summary(ols1); ... # uses 'robust' variancescovariances You can substitute bootcov for robcov to use bootstrap estimates rather than Huber-White sandwich estimates. Note that coefficients are unchanged. Please provide your affiliation in e-mail postings. Frank Yoseph Zuback wrote: Using hccm() I got a heteroscedasticity correction factor on the diagonal of the return matrix, but I don't know how to incorporate this into my linear model: METHOD 1: OLS1 - lm(formula=uer92~uer+low2+mlo+spec+degree+hit) Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) -0.0623377 0.0323461 -1.927 0.057217 . uer 0.2274742 0.0758720 2.998 0.003541 ** low2 0.0276404 0.0375770 0.736 0.463973 mlo 0.1491490 0.0940637 1.586 0.116455 spec-0.1139978 0.0312223 -3.651 0.000445 *** degree 0.0014694 0.0005316 2.764 0.006970 ** hit -0.0164365 0.0186028 -0.884 0.379376 hccm(OLS1) (Intercept) uer low2 mlo spec (Intercept) 9.057187e-04 -1.330377e-03 -3.486945e-05 2.184561e-04 -4.061445e-04 uer -1.330377e-03 5.471543e-03 3.513046e-04 -4.294427e-04 1.629196e-03 low2-3.486945e-05 3.513046e-04 1.378587e-03 1.241245e-04 -5.026434e-05 mlo 2.184561e-04 -4.294427e-04 1.241245e-04 9.796132e-03 -1.059611e-03 spec-4.061445e-04 1.629196e-03 -5.026434e-05 -1.059611e-03 9.777099e-04 degree 9.638288e-07 -2.907824e-05 -1.093692e-05 -1.867397e-05 -8.212461e-06 hit -3.299600e-04 -2.242984e-04 1.036364e-04 -8.158489e-04 3.994951e-05 degree hit (Intercept) 9.638288e-07 -3.299600e-04 uer -2.907824e-05 -2.242984e-04 low2-1.093692e-05 1.036364e-04 mlo -1.867397e-05 -8.158489e-04 spec-8.212461e-06 3.994951e-05 degree 3.485174e-07 4.256330e-06 hit 4.256330e-06 4.154505e-04 I have reached my limit of R knowledge, any help is appreciated. [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@r-project.org 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] problems installing R packages
The error messages indicated the ``zip.unpack'' problems. Try to download the zip file to your HD, and reinstall the package again. If this do not work, I hope that you can get a time machine. Guo-Hao Huang -- From: catuxa-2 catuxa...@gmail.com Sent: Wednesday, December 02, 2009 8:18 PM To: r-help@r-project.org Subject: Re: [R] problems installing R packages Thank you!!! It was just the run as administrator, sorry But anyway, i can´t change the version because i'm developing a java aplication integraed with R, and the people who configurate te computer recomended me not to change the version. I'm not in love with late 2006! But i think that i need to risk changing it, becaus i'm having lots of problems Do you know something of integrate eclipse and R??? Thank you 2009/12/2 Romain Francois [via R] ml-node+933022-1560375...@n4.nabble.comml-node%2b933022-1560375...@n4.nabble.com On 12/02/2009 12:55 PM, catuxa-2 wrote: Hi, I´m trying to install new package in R (version 2.4.0) under windows vista and i have problems. I always receive the same message: Erro en zip.unpack(pkg, tmpDir) : no fue posible abrir el archivo 'C:/Program Files/R/R-2.4.0/library/file2019500d/mprobit/libs/mprobit.dll' It can´t open the file. I check the compatibility with the version and is ok, I have no idea where's the problem cause i'm the administrator and i've enough free space in the hard disc. Anyone could help me Try to time travel back in late 2006 when 2.4.0 was current, or upgrade to the current version of R (2.10.0) for which you might get support ... whichever way is easiest for you. When you are done, please lend us your time travel machine so that we can get R 3.0.0 from the future. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/FtUu : new package : highlight |- http://tr.im/EAD5 : LondonR slides `- http://tr.im/BcPw : celebrating R commit #5 __ [hidden email]http://n4.nabble.com/user/SendEmail.jtp?type=nodenode=933022i=0mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View message @ http://n4.nabble.com/problems-installing-R-packages-tp933010p933022.html To unsubscribe from problems installing R packages, click here (link removed) ==. -- View this message in context: http://n4.nabble.com/problems-installing-R-packages-tp933010p933030.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] Joint density kde2d works improperly?
On Wed, 2 Dec 2009 11:14:14 +0100 Trafim rdapam...@gmail.com wrote: As far as I understood from Help kde2d returns matrix elements of which are values of joint probability mass function Pr(X=x,Y=y) therefore, sum of its elements should sum to 1. No, they're values of a joint *density* function, which should usually *not* sum to 1. -- Karl Ove Hufthammer __ R-help@r-project.org 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] Again on overlaying plots (a plot region within a plot region)
On Dec 2, 2009, at 3:15 AM, Ottorino-Luca Pantani wrote: Dear R-users, after seeking for help in R-search I did not find any hint on my particular problem. Countless help on true overlay, but nothing on this. Please consider the following: par(mfrow = c(2, 1)) T - seq(0, 20, by = 0.01) ## PLOT 1 plot(T, 30*exp(-0.65*T), type = l ) points(T, 30*exp(-0.26 * T), type = l, lty = F8) points(T, 30*exp(-0.15 * T), type = l, lty = 39) ## PLOT 2 plot(T, 30*exp(-0.65*T), type = l, log= y ) points(T, 30*exp(-0.26 * T), type = l, lty = F8) points(T, 30*exp(-0.15 * T), type = l, lty = 39) What I would like to do is to draw a square plot of PLOT 1 and then overlay the *entire* PLOT 2 on the upper right corner of PLOT 1, when there's a lot of empty space I have to do that because the publisher asked me not to waste much space with figures. The subplot function in the excellent TeachingDemos package offer a complete solution. http://finzi.psych.upenn.edu/R/library/TeachingDemos/html/subplot.html -- David I studied for some time the Paul Murrell's excellent book R Graphics, but I did not find what I'm looking for. As far as I understand, layout() is intended to flexibly divide the plot region, not to subdivide the plot region nor the figure region. One solution could be to export PLOT 1 , say as png, and then overlay on it PLOT 2 with pixmap() as in this example http://www.stat.auckland.ac.nz/~paul/RGraphics/custombase-pixmap.R but it seems to me a bit too much complicate Thanks in advance for your time -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Ubuntu 8.04.3 LTS -- GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.9) ESS version 5.5 -- R 2.10.0 __ R-help@r-project.org 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. David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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] residuals from nls fit on time series
Hi, I've been fitting some time-series data to x ~ c + m*t + a*exp(-t*k) with nls. The fit works fine, and I can get the residuals out by summary(fit)$residuals. My problem is that the residuals are not a time series, so when I plot them, I get 0:1 on the x-axis, instead of eg. 0:0.5, or 0:5 (depends on the exact fit). Is there any way of getting the times out of the fit, or am I stuck? Thanks Jon Phillips This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. __ R-help@r-project.org 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] A ggplot question
Hi all, I want be more clear what I want to do. Please consider following code : ggplot(diamonds, aes(carat, ..density..)) + geom_histogram(binwidth = 0.2, aes(fill = cut)) + facet_grid(. ~ cut) Here you see there is no need for the color-pallet named cut, as the sub-plot headings take care of them. My question is how I can remove the color-pallet. Your help will be highly appreciated. Thanks, Megh wrote: Thanks Ista for your mail. Here I wanted to have control on color-pallet. It is because, here my entire plot window is subdivided in 3 sub-plots horizontally, on basis if a factor-variable which contains three factors, using facet_grid(). Each sub-plot contains scatter-plot. I want to color the points of each scatter-plot based on the corresponding factor (contained in factor-variable). Therefore as you might agree in this case, there is no need for additional color-pallet as the factor-description is handled by facet_grid() function itself. Any better idea how I can hide color-pallet? Thanks, Ista Zahn wrote: There was a recent discussion of the ggplot2 mailing list about a similar issue. The first question is how will people know what the colors mean if you remove the legend? -Ish On Tue, Dec 1, 2009 at 11:41 PM, Megh megh700...@yahoo.com wrote: Let consider following plot : p - ggplot(mtcars, aes(mpg, wt)) p + geom_point(colour=grey50, size = 4) + geom_point(aes(colour = cyl)) Now I want R to hide the color-pallet on cyl, placed in the right edge completely. Can anyone please guide me how to do that? Thanks, -- View this message in context: http://n4.nabble.com/A-ggplot-question-tp932775p932775.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ R-help@r-project.org 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. -- View this message in context: http://n4.nabble.com/A-ggplot-question-tp932775p933073.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Joint density kde2d works improperly?
Dear Dennis, thanks a lot for your response. I have two time series and need to approximate there joint density. The only thing I cannot find out is how to find the values of this function in the points not from the resulting grid matrix Thanks a lot You're using a function that provides an estimate of a *continuous* bivariate density to approximate a bivariate discrete distribution? If your joint distribution is discrete, there are better ways to visualize it, and I'll leave it up to you to discover how. (Hint: look at the 3D graphics packages.) DM On Wed, Dec 2, 2009 at 2:14 AM, Trafim rdapam...@gmail.com wrote: Dear all, Please, look at the following code: attach(geyser) f1 - kde2d(duration, waiting, n = 5) a - 0 for (i in 1:5){ for (j in 1:5){ a - a + f1$z[i,j] } } As far as I understood from Help kde2d returns matrix elements of which are values of joint probability mass function Pr(X=x,Y=y) therefore, sum of its elements should sum to 1. Which is not the case from my check. Where is the problem here? Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org 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. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Cryptic error message from rfe (in caret package)
Good etiquette would be to email the maintainer (me) with a reproducibility example and the results of sessionInfo(). Max On Wed, Dec 2, 2009 at 7:13 AM, Richard R. Liu richard@pueo-owl.ch wrote: When using the function rfe I receive the warning In x == y : longer object length is not a multiple of shorter object length more than 50 times. I call rfe as follows: nbProfile - rfe(features.train.50pct, truth.train.50pct, sizes = no.features, rfeControl = nbCtrl) where features.train.50pct data frame of 8 named columns, each of 487 rows, numeric truth.train.50pct factor of 487 logical elements sizes 1, 2, ..., 8 nbCtrl rfeControl(functions = nbFuncs, method = cv, verbose = F, returnResamp = final) Does anybody know to which objects the warnings refer? Richard R. Liu Dittingerstr. 33 CH-4053 Basel Switzerland Tel.: +41 61 331 10 47 Mobil: +41 79 708 67 66 Email: richard@pueo-owl.ch __ R-help@r-project.org 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. -- Max __ R-help@r-project.org 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] Calling R (GNU R) functions from Common Lisp, how?
On Dec 2, 2009, at 6:34 AM, Hrishi Mittal wrote: RCL looks promising - http://common-lisp.net/project/rcl/ It seems more than a bit worrisome that the above page currently ends with complex objects (in particular data frames) are handled very poorly. Dataframes may not be a fundamental data type, but they are arguably the dominant structure in typical R programmming. For quick and short calls to R, you can always use the system commands in CL to call R CMD or Rscript. tsunhin wong wrote: Hi Lisp users, I'm a user of both Common Lisp and R (GNU R). I found R has a rich collection of statistical and numerical computation functions, while it is not as extensible as Lisp (Common Lisp). I considered Lisp-Stat but its only implementation is not in the usuall Common Lisp, and the available functions in CRAN are far richer than Lisp-Stat currently has. I want to know if there is already an existing way of calling R functions from within Common Lisp? If no, please point me to relevant resources so that I can create one (that works in a platform-independent manner). Best, tjw -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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] category with respect to category
?mosaicplot -Peter Ehlers Ahmet Temiz wrote: hello I have two categorical data and want to visualise them to see their changes? Which graph do you recommend me for category with respect to category ? kind regards Ahmet Temiz -- Open WebMail Project (http://openwebmail.org) __ R-help@r-project.org 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] sort a data frame by a vector
Thanks to all who replied. Issue solved Jeff On Wed, December 2, 2009 12:52 am, Don MacQueen wrote: This looks like a job for match(). vec = c(C, A, B) dataDF = data.frame(A1 = c(B, A, C), A2 = c(1,2,3)) dataDF[match(dataDF$A1,vec),] A1 A2 3 C 3 2 A 2 1 B 1 -Don At 10:36 PM -0500 12/1/09, Hao Cen wrote: Hi, I have a a vector and a data frame with two columns vec = c(C, A, B) dataDF = data.frame(A1 = c(B, A, C), A2 = c(1,2,3)) I would like to sort the data frame by column A1 such that the order of elements in A1 is as the same as in vec. After the ordering, the data frame would be A1 A2 C 3 A 2 B 1 Any suggestions would be appreciated. Thanks in advance Jeff [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- - Don MacQueen Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 m...@llnl.gov - __ R-help@r-project.org 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] Replying to Posts Within Same Thread
Whether or not your reply is threaded can also be due to the client you use (if you use an email client). For instance, this reply will be threaded correctly because I used Thunderbird. However, had I used my university-approved Groupwise client it would appear as a new thread. Best, Jim David Winsemius wrote: On Dec 1, 2009, at 10:42 PM, Charlotte Maia wrote: On 12/2/09, John Sorkin jsor...@grecc.umaryland.edu wrote: I don't know what you are doing wrong because I don't know exactly what you are doing. I do know that I don't have your problem when I simply reply to a message without touching the subject line. John Could you clarify the notion of simply reply. There is no obvious reply links in either the archive page, or the digest. True. The archive does not expose the message headers. I have not figured out whether is is even possible to respond to a message on the Archive. Some people use Gmane or Nabble, but I think most use a mail-client. Responding to the digest can break threads. In the case, where someone sends me an email, such have you have done, I can simply reply. However, in general this option is not available. I am wondering why it wouldn't be? This particular message is threaded with the posting you made a little over an hour ago, whereas some of your replies in the last few days have been orphaned from the posting you responded to (as you have noticed). You can look at the threaded archive here (as I suspect you already know): https://stat.ethz.ch/pipermail/r-help/ Best -- James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826 ** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues __ R-help@r-project.org 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] Aligning Diagonally Oriented Labels Under Bar Chart
Peter, Thank you for your reply. That got me a lot closer. Now I just need to move the text down a bit and it will be perfect. Thank you for your suggestion of creating a reference to barplot and passing that as an argument into text. That seems to have made the difference. Here is what I've ended up with so far: # Reference the following URL for information about rotating axis labels: # http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f # mar A numerical vector of the form c(bottom, left, top, right) which gives the number of lines # of margin to be specified on the four sides of the plot. The default is c(5, 4, 4, 2) + 0.1. par(mar = c(7, 4, 4, 2) + 0.1) barplot_reference-barplot(WorldPhones[1,], ylim=c(0, 5), axes=FALSE, ann=FALSE, col=terrain.colors(length(WorldPhones[1,])), xaxt = n, xlab = ) # xpd A logical value or NA. If FALSE, all plotting is clipped to the plot region, if TRUE, # all plotting is clipped to the figure region, and if NA, all plotting is clipped to # the device region. text(barplot_reference, par(usr)[3] - 0.25, srt = 45, adj = 1, labels = as.character(colnames(WorldPhones)), xpd = TRUE) #axis(1, at = barplot_reference, labels = as.character(colnames(WorldPhones)), srt = 45, adj = 1) box() Any suggestions on adjusting the text down a bit is also greatly appreciated. Thank you again. - Original Message From: Peter Alspach peter.alsp...@plantandfood.co.nz To: Jason Rupert jasonkrup...@yahoo.com; R-help@r-project.org Sent: Tue, December 1, 2009 5:29:17 PM Subject: RE: [R] Aligning Diagonally Oriented Labels Under Bar Chart Tena koe Jason Is this an example of what you want? temp - barplot(3:17) text(temp, rep(-0.5, length(3:17)), LETTERS[3:17], srt=45, adj=1) HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jason Rupert Sent: Wednesday, 2 December 2009 12:16 p.m. To: R-help@r-project.org Subject: [R] Aligning Diagonally Oriented Labels Under Bar Chart I searched the forms (i.e., R Search) and come up with the following suggested link: http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create- rotated-axis-labels_003f I tried to implement what I believe was being implied by that URL and came up with the below: barplot(WorldPhones[1,], ylim=c(0, 5), axes=FALSE, ann=FALSE, col=terrain.colors(length(WorldPhones[1,])), xaxt = n, xlab = ) text(1:dim(WorldPhones)[1], par(usr)[3] - 0.1, srt = 45, adj = 1, labels = as.character(colnames(WorldPhones)), xpd = TRUE) box() Unfortunately the labels are not aligned with the appropriate bars. I believe I am missing something small in order to have the text properly aligned underneath the appropriate bars. Are there any suggestions for correcting this mis-alignment? Thank you again for any additional feedback, links, hints or insights. __ R-help@r-project.org 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@r-project.org 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] Generate missing data patterns
Dear R-users, i try to generate missing values in a matrix X according to a given missingnes pattern R with the probabilities p per row. X-matrix(rnorm(3*100),ncol=3) ## indicator matrix for missingnes (1 observed, 0 missing) R-matrix(c(1,1,1, 0,0,1, 1,1,0, 0,1,1),ncol=3,byrow=TRUE) ## probabilities for row 1, row 2, row 3 and row 4 p-c(0.375,0.25,0.25,0.125) ## does not exactly what i want, because i get rows ## of missinges pattern which are not in R X[rbinom(100,1,p[1])==1,R[1,]==1] - NA X[rbinom(100,1,p[2])==1,R[2,]==1] - NA X[rbinom(100,1,p[3])==1,R[3,]==1] - NA X[rbinom(100,1,p[4])==1,R[4,]==1] - NA So it would be great if i can get any advice how to do this. I also tried rmultinom or sample but without any success so far. Another question is what to to if want the missing pattern R and simulate a certain amount of missingnes mybe about 10 %? I guess i have to mix the probabilities for each row in such a way to get approximatly the wanted missingnes in percent. best regards Andreas __ R-help@r-project.org 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] find the index of the next largest element in a sorted vector
Hi, How can I find the index of the next largest element in a sorted vector if an element is not found. for example, searching 2 in c(0,3,4) would return 1 since 2 is not in the vector and 0 is the next largest element to 2. I tried which and match and neither returns such information. which(c(0,3,4) == 2) integer(0) match(2, c(0,3,4)) [1] NA thanks Jeff __ R-help@r-project.org 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] plotting two surfaces simultaneously in a single panel
On Fri, Nov 27, 2009 at 6:14 PM, Umesh Srinivasan umesh.sriniva...@gmail.com wrote: Hi, I have recently begun using the lattice package, and have been using the wireframe command to visualise matrices which are model outputs. I have been trying to plot two surfaces (from two matrices) simultaneously in one panel, to visualise intersections etc., but neither my attempts or trawling the net are helping me find how to do this. The documentation for wireframe mentions the use of 'groups' to do this, and the usual shortcut of using formulae of the form z1+z2 ~ x + y also works. The following seems to work as expected, subject to caveats mentioned in ?wireframe and ?panel.wireframe (there is no hidden surface removal going on, so intersections will not be shown correctly). df - as.data.frame.table(volcano) names(df) - c(x, y, height) df$sheight - scale(df$height) wireframe(sheight + (-sheight) ~ x + y, df, aspect = c(1, .5)) -Deepayan __ R-help@r-project.org 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] Passing additional argument to be numerically integrated function
You may have hidden your posting by responding to an unrelated thread. (Avoid that in the future.) You need to be looking at: ?function #and associated topics This will drop you into a discussion that may be germane to your task: http://finzi.psych.upenn.edu/Rhelp08/2009-April/194648.html The above link was found with: RSiteSearch(match args) (There is a function named match.arg, whose precise spelling I had forgotten.) -- David On Dec 1, 2009, at 8:46 PM, Amir Liu wrote: Hi, I try to use the numerical integration functionality of R to integrate a univariate (1D) function. Below I am integrating function const1 which works nicely as expected. But for some reasons I need to pass to my function that I want to integrate an additional parameter. If it were object-oriented I just would invoke some setter methods onto a object providing functionality described in function constX and then pass this object on. And according to the help page the function can have more than one argument, just the first needs to be the argument vector for the integration function: - f: an R function taking a numeric first argument and returning a numeric vector of the same length. Returning a non-finite element will generate an error. But let us say I have an additional argument called nb that I want to pass as well. How would I pass this second argument (and possibly more additional arguments) to make case 2 work, i.e. how this is expressed in R syntax? integ - function() { # case 1: no argument for function to be integrated # integrate box function of height 1 from 0 to 2 val - integrate(const1,0,2) print(val) # case 2: one ore more argument for function to be integrated # integrate box function of height nb from 0 to 2 nb - 5 val1 - integrate(constX,0,2) print(val1) } const1 - function(x) { return(rep(1,length(x))) } constX - function(x,nb) { return(rep(nb,length(nb))) } Kind Regards, Amir -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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] Aligning Diagonally Oriented Labels Under Bar Chart
Pasting a few trailing spaces worked for me. On Dec 2, 2009, at 9:29 AM, Jason Rupert wrote: Peter, Thank you for your reply. That got me a lot closer. Now I just need to move the text down a bit and it will be perfect. Thank you for your suggestion of creating a reference to barplot and passing that as an argument into text. That seems to have made the difference. Here is what I've ended up with so far: # Reference the following URL for information about rotating axis labels: # http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f # mar A numerical vector of the form c(bottom, left, top, right) which gives the number of lines # of margin to be specified on the four sides of the plot. The default is c(5, 4, 4, 2) + 0.1. par(mar = c(7, 4, 4, 2) + 0.1) barplot_reference-barplot(WorldPhones[1,], ylim=c(0, 5), axes=FALSE, ann=FALSE, col=terrain.colors(length(WorldPhones[1,])), xaxt = n, xlab = ) # xpd A logical value or NA. If FALSE, all plotting is clipped to the plot region, if TRUE, # all plotting is clipped to the figure region, and if NA, all plotting is clipped to # the device region. text(barplot_reference, par(usr)[3] - 0.25, srt = 45, adj = 1, labels = as.character(colnames(WorldPhones)), xpd = TRUE) #axis(1, at = barplot_reference, labels = as.character(colnames(WorldPhones)), srt = 45, adj = 1) box() Any suggestions on adjusting the text down a bit is also greatly appreciated. Thank you again. - Original Message From: Peter Alspach peter.alsp...@plantandfood.co.nz To: Jason Rupert jasonkrup...@yahoo.com; R-help@r-project.org Sent: Tue, December 1, 2009 5:29:17 PM Subject: RE: [R] Aligning Diagonally Oriented Labels Under Bar Chart Tena koe Jason Is this an example of what you want? temp - barplot(3:17) text(temp, rep(-0.5, length(3:17)), LETTERS[3:17], srt=45, adj=1) HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jason Rupert Sent: Wednesday, 2 December 2009 12:16 p.m. To: R-help@r-project.org Subject: [R] Aligning Diagonally Oriented Labels Under Bar Chart I searched the forms (i.e., R Search) and come up with the following suggested link: http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create- rotated-axis-labels_003f I tried to implement what I believe was being implied by that URL and came up with the below: barplot(WorldPhones[1,], ylim=c(0, 5), axes=FALSE, ann=FALSE, col=terrain.colors(length(WorldPhones[1,])), xaxt = n, xlab = ) text(1:dim(WorldPhones)[1], par(usr)[3] - 0.1, srt = 45, adj = 1, labels = as.character(colnames(WorldPhones)), xpd = TRUE) box() Unfortunately the labels are not aligned with the appropriate bars. I believe I am missing something small in order to have the text properly aligned underneath the appropriate bars. Are there any suggestions for correcting this mis-alignment? Thank you again for any additional feedback, links, hints or insights. __ R-help@r-project.org 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@r-project.org 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. David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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] find the index of the next largest element in a sorted vector
On Dec 2, 2009, at 9:34 AM, Hao Cen wrote: Hi, How can I find the index of the next largest element in a sorted vector if an element is not found. for example, searching 2 in c(0,3,4) would return 1 since 2 is not in the vector and 0 is the next largest element to 2. I tried which and match and neither returns such information. which(c(0,3,4) == 2) integer(0) match(2, c(0,3,4)) [1] NA Take a look at these. I changed to problem so that the answer would be in the middle of the sequence. which(c(0,3,4) = 2) [1] 1 # but which would have retruned several values if the match were in the middle which(c(-3,-1, 0,3,4) = 2) [1] 1 2 3 tail(which(c(-3,-1,0,3,4) = 2),1) [1] 3 # the desired index -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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] find the index of the next largest element in a sorted vector
Is this what you want: x - c(0,3,4) ?findInterval findInterval(2, x) [1] 1 On Wed, Dec 2, 2009 at 9:34 AM, Hao Cen h...@andrew.cmu.edu wrote: Hi, How can I find the index of the next largest element in a sorted vector if an element is not found. for example, searching 2 in c(0,3,4) would return 1 since 2 is not in the vector and 0 is the next largest element to 2. I tried which and match and neither returns such information. which(c(0,3,4) == 2) integer(0) match(2, c(0,3,4)) [1] NA thanks Jeff __ R-help@r-project.org 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org 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 export a function from a package and access it only by specifying the namespace?
On Tue, Dec 1, 2009 at 11:27 PM, Sharpie ch...@sharpsteen.net wrote: Peng Yu wrote: Then I try the package 'try.package' in an R session. I'm wondering why neither 'my_test_f' and 'try.package::my_test_f' work. The error message you got below clearly explains this-- you did not export my_test_f in your NAMESPACE file. To access unexported functions, you must use the ':::' operator: try.package:::my_test_f() Peng Yu wrote: Why 'my_test_g' can be accessed with 'try.package::' and without 'try.package::'? Because you exported it in the NAMESPACE file. Peng Yu wrote: Is there a way to make 'my_test_g' accessible only by specifying the namespace 'try.package::'? No. The purpose of the '::' operator is for those cases where multiple packages are loaded that each export a function with the same name. This is known as masking and the last loaded package will contribute the dominant function-- i.e. the function the gets called when the user types functionName() and not packageName::functionName(). The :: operator allows the selection of functions that are masked by the dominant function. If you really want to conceal a function from user-level code, don't export it and it will only be accessible via the ::: operator. Is there a way to list all the functions in a namespace? I tried the following one, but it is not working. showMethods(where=getNamespace('try.package')) No applicable functions __ R-help@r-project.org 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] A ggplot question
Hi Megh, just set the legned position to 'none' using options, by putting + opts(legend.position=none) after your code. ggplot(diamonds, aes(carat, ..density..)) + geom_histogram(binwidth = 0.2, aes(fill = cut)) + facet_grid(. ~ cut) + opts(legend.position=none) HTH, Matthieu __ R-help@r-project.org 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] Ridge regression
Dear list, I have a couple of questions concerning ridge regression. I am using the lm.ridge(...) function in order to fit a model to my microarray data. Thus *model=lm.ridge(...)* I retrieve some coefficients and some scales for each gene. First of all, I would like to ask: the real coefficients of the model are not included in the first argument of the output but in the result of coef(model), am I right? Moreover, what does the scale argument represent? Which is its connection with the coefficients? The R help file os not very informative for me... Thank you very much in advance, Eleni Christodoulou [[alternative HTML version deleted]] __ R-help@r-project.org 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] Problem with Cannot compute correct p-values with ties
I am sorry that I didn't express my question more clearly and made you understand it so difficult. But thank you all your kind help very much and I have used another method for solving it. Thank you all again! [1]guohao.hu...@gmail.com åé: Please try to find answers by yourself You should not just post problems without thinking them. Huang, Guo-Hao -- From: Zhijiang Wang [2]ivoryto...@emails.bjut.edu.cn Sent: Wednesday, December 02, 2009 4:52 PM To: [3]R-help@r-project.org Subject: [R] Problem with Cannot compute correct p-values with ties Dear All, 1. why did the problem happen? 2. How to solve it? -- Best wishes, Zhijiang Wang PHD Student Room 212, Science buliding, The International WIC Institute, College of Computer Science and Technology, Beijing University of Technology, Beijing, China. __ [4]r-h...@r-project.org mailing list [5]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [6]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Best wishes, Zhijiang Wang PHD Student Room 212, Science buliding, The International WIC Institute, College of Computer Science and Technology, Beijing University of Technology, Beijing, China. References 1. mailto:guohao.hu...@gmail.com 2. mailto:ivoryto...@emails.bjut.edu.cn 3. mailto:R-help@r-project.org 4. mailto:R-help@r-project.org 5. https://stat.ethz.ch/mailman/listinfo/r-help 6. http://www.R-project.org/posting-guide.html __ R-help@r-project.org 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] Ridge regression
On Dec 2, 2009, at 10:42 AM, Eleni Christodoulou wrote: Dear list, I have a couple of questions concerning ridge regression. I am using the lm.ridge(...) function in order to fit a model to my microarray data. Thus *model=lm.ridge(...)* I retrieve some coefficients and some scales for each gene. First of all, I would like to ask: the real coefficients of the model are not included in the first argument of the output but in the result of coef(model), am I right? Not exactly. coef(model) extracts the coefficients from the model but the coefficients do in the example instance I created following the help page happen to be in the first element of the model. eg: long.rr$coef GNP Unemployed Armed.Forces Population Year Employed 25.36152883.30094160.7520553 -11.6992718 -6.5403380 0.7864825 long.rr[[1]] GNP Unemployed Armed.Forces Population Year Employed 25.36152883.30094160.7520553 -11.6992718 -6.5403380 0.7864825 Moreover, what does the scale argument represent? Which is its connection with the coefficients? The R help file os not very informative for me... A plausible response to such a question might be that the help page is a sketchy substitute for the MASS book. However, I cannot find ridge regression in the table of contents or in the index of my copy, but I only have ed. 2 and the current edition is the 4th. So we will both need to wait for more knowledgeable (or with more recent editions of MASS) persons to answer that question. (And scales is not an argument, rather it's a returned value.) Thank you very much in advance, Eleni Christodoulou David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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] standardized beta weights for lmer models
Dear Sir or Madam, I am using the lme4 package to model the effect of various variables on binomial response data in a repeated measurements design. Besides the significance of the main predictors, we are also interested in the size and direction of the (partial) correlation of the predictors with the dependent variable. Therefore, we wonder whether the estimates listed under coefficients in the model summary are standardized or not. Could you inform us about this? And if they are not standardized, is there a way (or package) to calculate the standardized beta-weights and/or the partial correlations belonging to the predictor variables in logit lmer models? Thank you very much for your help. Best regards, Annett __ R-help@r-project.org 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] Ridge regression
On Dec 2, 2009, at 11:04 AM, David Winsemius wrote: On Dec 2, 2009, at 10:42 AM, Eleni Christodoulou wrote: Dear list, I have a couple of questions concerning ridge regression. I am using the lm.ridge(...) function in order to fit a model to my microarray data. Thus *model=lm.ridge(...)* I retrieve some coefficients and some scales for each gene. First of all, I would like to ask: the real coefficients of the model are not included in the first argument of the output but in the result of coef(model), am I right? Not exactly. coef(model) extracts the coefficients from the model but the coefficients do in the example instance I created following the help page happen to be in the first element of the model. eg: long.rr$coef GNP Unemployed Armed.Forces Population Year Employed 25.36152883.30094160.7520553 -11.6992718 -6.5403380 0.7864825 long.rr[[1]] GNP Unemployed Armed.Forces Population Year Employed 25.36152883.30094160.7520553 -11.6992718 -6.5403380 0.7864825 Moreover, what does the scale argument represent? Which is its connection with the coefficients? The R help file os not very informative for me... A plausible response to such a question might be that the help page is a sketchy substitute for the MASS book. However, I cannot find ridge regression in the table of contents or in the index of my copy, but I only have ed. 2 and the current edition is the 4th. So we will both need to wait for more knowledgeable (or with more recent editions of MASS) persons to answer that question. After a bit more searching, I am thinking that the 4th edition may not be teh source for answers. It appears that lm.ridge is a worked answer to one of hte questions at the back of chapter 6. See p 6 and 24 (in the pdf numbering): http://www.stats.ox.ac.uk/pub/MASS4/VR4ex.pdf (And scales is not an argument, rather it's a returned value.) Thank you very much in advance, Eleni Christodoulou David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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. David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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: adding information on number of observations
The boxplot with sample size information is one of the features included in the HH package. An example is posted on my site http://astro.ocis.temple.edu/~rmh/HH/bwplot-color.pdf In this example I show grouping, control of x-axis position, multiple x-axis labels, and control of display of extreme outliers. Rich __ R-help@r-project.org 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] Extract html tables to data.frames
See readHTMLTable in XML package. On Wed, Dec 2, 2009 at 2:14 PM, Daniel Brewer daniel.bre...@icr.ac.uk wrote: Hello, I would like to scrape some html tables from a web page and convert them to a data.frame so I can perform further analysis. Could anyone tell me the best way to do this? Would it be more appropriate to use an external tool first? Thanks Dan -- ** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis Email: daniel.bre...@icr.ac.uk ** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}} __ R-help@r-project.org 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org 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] problems installing R packages
Try to install your old R version in a non system folder (like C:/R/R-2.4.0) Correct me if I'm wrong, but I believe that in vista you can't install packages in a system folder ('C:/Program Files/R/R-2.4.0) even if you have administrator privileges... Héctor On 2 Dec 2009 at 3:55, catuxa-2 wrote: Date sent: Wed, 2 Dec 2009 03:55:21 -0800 (PST) From: catuxa-2 catuxa...@gmail.com To: r-help@r-project.org Subject:[R] problems installing R packages Hi, I´m trying to install new package in R (version 2.4.0) under windows vista and i have problems. I always receive the same message: Erro en zip.unpack(pkg, tmpDir) : no fue posible abrir el archivo 'C:/Program Files/R/R-2.4.0/library/file2019500d/mprobit/libs/mprobit.dll' It can´t open the file. I check the compatibility with the version and is ok, I have no idea where's the problem cause i'm the administrator and i've enough free space in the hard disc. Anyone could help me -- View this message in context: http://n4.nabble.com/problems-installing-R-packages-tp933010p933010.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. -- Héctor Villalobos hvill...@ipn.mx CICIMAR - IPN A.P. 592. Col. Centro La Paz, Baja California Sur, MÉXICO. 23000 Tels. (+52 612) 122 53 44; 123 46 58; 123 47 34 ext. 82425 Fax. (+52 612) 122 53 22 [[alternative HTML version deleted]] __ R-help@r-project.org 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] problems installing R packages
Héctor Villalobos wrote: Try to install your old R version in a non system folder (like C:/R/R-2.4.0) Correct me if I'm wrong, but I believe that in vista you can't install packages in a system folder ('C:/Program Files/R/R-2.4.0) even if you have administrator privileges... In that case nobody could install anything. No, you can, but you really need the privileges, i.e. right click on startup of R and tell the OS to start R really with Admin privieges. Uwe Ligges Héctor On 2 Dec 2009 at 3:55, catuxa-2 wrote: Date sent: Wed, 2 Dec 2009 03:55:21 -0800 (PST) From: catuxa-2 catuxa...@gmail.com To: r-help@r-project.org Subject:[R] problems installing R packages Hi, I´m trying to install new package in R (version 2.4.0) under windows vista and i have problems. I always receive the same message: Erro en zip.unpack(pkg, tmpDir) : no fue posible abrir el archivo 'C:/Program Files/R/R-2.4.0/library/file2019500d/mprobit/libs/mprobit.dll' It can´t open the file. I check the compatibility with the version and is ok, I have no idea where's the problem cause i'm the administrator and i've enough free space in the hard disc. Anyone could help me -- View this message in context: http://n4.nabble.com/problems-installing-R-packages-tp933010p933010.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. -- Héctor Villalobos hvill...@ipn.mx CICIMAR - IPN A.P. 592. Col. Centro La Paz, Baja California Sur, MÉXICO. 23000 Tels. (+52 612) 122 53 44; 123 46 58; 123 47 34 ext. 82425 Fax. (+52 612) 122 53 22 [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] Starting estimates for nls Exponential Fit
Kate Mullen showed one approach to this problem by using DEOptim to get some good starting values. However, I believe that the real issue is scaling (Warning: well-ridden hobby-horse!). With appropriate scaling, as below, nls does fine. This isn't saying nls is perfect -- I've been trying to figure out how to do a nice job of helping folk to scale their problems. Ultimately, it would be nice to has an nls version that will do the scaling and also watch for some other situations that give trouble. Cheers, JN ## JN test rm(list=ls()) ExponValues - c(2018.34,2012.54,2018.85,2023.52,2054.58,2132.61,2247.17, 2468.32,2778.47) ExponCycles - c(17,18,19,20,21,22,23,24,25) mod - function(x) x[1] + x[2]*x[3]^ExponCycles modj - function(x) (1000*x[1] + 0.001*x[2]*x[3]^ExponCycles) fun - function(x) sum((ExponValues-mod(x))^2) pa-c(1,2,3) lo-c(0,0,0) up-c(20,20,20) names(pa) - c(Y0, a, E) ## fit w/port and GN Emodjn- nls(ExponValues ~ (1000*Y0 + 0.001*a*(E^ExponCycles)), start=pa, algorithm='port', lower=lo, upper=up, control=list(maxiter=1000, trace=TRUE, warnOnly=TRUE)) Emodjn1 - nls(ExponValues ~ (1000*Y0 + 0.001*a*(E^ExponCycles)), start=pa, control=list(maxiter=1000, trace=TRUE, warnOnly=TRUE)) ## fit matplot(cbind(ExponValues, fitted(Emodjn), fitted(Emodjn1)),type=l) __ R-help@r-project.org 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] pictures_in_a_matrix
Claudia Hantschel wrote: Dear all, how is it possible to upload first two figures (original: jpeg files, these are two pictures from a micrope) in a layout(matrix(c(1,2,3), 1,3), widths=c(2.5,1.5, 2.5), heights=c(1,1) ) (the last field of the matrix is for a barplot)? The hole matrix is then need to be safed as eps-format. Does it make sense to upload these figures in R? Many thanks for any help! Claudia. I am not sure if it makes much sense to load the pictures into R just to print them again. But if you really want to do it that way, see the book on R Graphics by Paul Murrell or his slides from useR! 2006: http://www.stat.auckland.ac.nz/~paul/Talks/rgraphs.pdf Best, Uwe Ligges __ R-help@r-project.org 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] Arithmetic on multiple files
Dear R-users, I'd like to perform arithmetic functions on 1000 files containing a 2000x2000 matrix. Can anyone advise? For example, File1File2 Output 1 1 1 4 4 4 5 5 5 2 2 2 +5 5 5= 7 7 7 3 3 3 6 6 6 9 9 9 Muhammad -- Muhammad Rahiz | Doctoral Student in Regional Climate Modeling Climate Research Laboratory, School of Geography the Environment Oxford University Centre for the Environment South Parks Road, Oxford, OX1 3QY, United Kingdom Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974 Email: muhammad.ra...@ouce.ox.ac.uk __ R-help@r-project.org 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] go back a block of code in history
Peng Yu wrote: Suppose I run the following code in the R session. At the last prompt '', I want to retrieve the second command (staring with 'y'). But I have to type up arrow many times, which is very inconvenient. I'm wondering if there is a way to configure R to skip block of code in the history? I don't think so, but since you are writing your code in an editor (hopefully), it is probably easier to submit the relevant part of the code from the editor to R again. Uwe Ligges x=list(a=c(1,2),b=c(3,4,5)) y=list(a=c(1,2),b=c(3,4,5)) lapply(seq(along=x) + ,function(i){ + cbind( + x[[i]] + ,y[[i]] + ) + } + ) [[1]] [,1] [,2] [1,]11 [2,]22 [[2]] [,1] [,2] [1,]33 [2,]44 [3,]55 __ R-help@r-project.org 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@r-project.org 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] Arithmetic on multiple files
About this: foo - function( files = c( file1, file2 ), nr = 3, nc = 3 ){ out - numeric( nr * nc ) for( i in seq_along(files)){ out - out + scan( files[i] , what = numeric(0), quiet = TRUE ) } matrix( out, nr = nr, nc = nc, byrow = T ) } foo() [,1] [,2] [,3] [1,]555 [2,]777 [3,]999 This would have been more fun if you could store them all in memory at once (which I think you can't) : files - c(file1, file2 ) matrices - lapply( files, scan, what = numeric(0), quiet = TRUE ) matrix( Reduce( +, matrices ), nr = 3, nc = 3, byrow = TRUE ) [,1] [,2] [,3] [1,]555 [2,]777 [3,]999 Romain On 12/02/2009 05:53 PM, Muhammad Rahiz wrote: Dear R-users, I'd like to perform arithmetic functions on 1000 files containing a 2000x2000 matrix. Can anyone advise? For example, File1 File2 Output 1 1 1 4 4 4 5 5 5 2 2 2 + 5 5 5 = 7 7 7 3 3 3 6 6 6 9 9 9 Muhammad -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/Gq7i : ohloh |- http://tr.im/FtUu : new package : highlight `- http://tr.im/EAD5 : LondonR slides __ R-help@r-project.org 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 script From PHP
How do I check whether R bin directory is added to PATH variable or not and if not then how do i add it? On Wed, Dec 2, 2009 at 5:34 PM, Romain Francois romain.franc...@dbmail.comwrote: On 12/02/2009 12:30 PM, Hrishi Mittal wrote: I agree with Romain that you should probably try and get Rserve to work as that is a much better way. However, to get your commandline version working, I suggest you use the Rscript comman instead of a bash script. So let's say you save your R script as a myscript.R file. Then do: shell_exec('Rscript /path/to/myscript.R'. 21); If that still gives you an error like Rscript command not found, then you need to make sure your R bin directory is added to the PATH system variable. ... maybe shell_exec('/usr/bin/Rscript /path/to/myscript.R'. 21); -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/FtUu : new package : highlight |- http://tr.im/EAD5 : LondonR slides `- http://tr.im/BcPw : celebrating R commit #5 [[alternative HTML version deleted]] __ R-help@r-project.org 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] Ridge regression
You are right that the ans$coef and coef(ans) are different in ridge regression, where `ans' is the object from lm.ridge. It is the coef(ans) that yields the coefficients on the original scale. ans$coef is the coefficient of X-scaled and Y-centered version. Here is an example that illustrates the workings of ridge regression. First let us create some data: X1 - runif(20) X2 - runif(20) Y - 2 * X1 - 2 * X2 + rnorm(20, sd=0.1) lam - 10 ans1 - lm.ridge(Y ~ X1 + X2, lambda = lam) ans1$coef coef(ans1) # Note that these two are different # Now Let us scale the variables X1 and X2 and center Y # cY - scale(Y, scale=FALSE) n - length(Y) sX1 - scale(X1) * sqrt(n/(n-1)) sX2 - scale(X2) * sqrt(n/(n-1)) require(MASS) lam - 10 ans2 - lm.ridge(cY ~ sX1 + sX2, lambda = lam) ans2$coef coef(ans2) # Now, see that the coefficients of sX1 and sX2 are the same # This is the connection! # Armed with this insight, we now compare the ans1$coef with scaled coefficients # ans1$coef c(coef(ans1)[2] * sd(X1), coef(ans1)[3] * sd(X2)) * sqrt((n-1)/n) # Now they are the same! I hope this is clear. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvarad...@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h tml -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Wednesday, December 02, 2009 11:04 AM To: Eleni Christodoulou Cc: r-help@r-project.org Subject: Re: [R] Ridge regression On Dec 2, 2009, at 10:42 AM, Eleni Christodoulou wrote: Dear list, I have a couple of questions concerning ridge regression. I am using the lm.ridge(...) function in order to fit a model to my microarray data. Thus *model=lm.ridge(...)* I retrieve some coefficients and some scales for each gene. First of all, I would like to ask: the real coefficients of the model are not included in the first argument of the output but in the result of coef(model), am I right? Not exactly. coef(model) extracts the coefficients from the model but the coefficients do in the example instance I created following the help page happen to be in the first element of the model. eg: long.rr$coef GNP Unemployed Armed.Forces Population Year Employed 25.36152883.30094160.7520553 -11.6992718 -6.5403380 0.7864825 long.rr[[1]] GNP Unemployed Armed.Forces Population Year Employed 25.36152883.30094160.7520553 -11.6992718 -6.5403380 0.7864825 Moreover, what does the scale argument represent? Which is its connection with the coefficients? The R help file os not very informative for me... A plausible response to such a question might be that the help page is a sketchy substitute for the MASS book. However, I cannot find ridge regression in the table of contents or in the index of my copy, but I only have ed. 2 and the current edition is the 4th. So we will both need to wait for more knowledgeable (or with more recent editions of MASS) persons to answer that question. (And scales is not an argument, rather it's a returned value.) Thank you very much in advance, Eleni Christodoulou David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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@r-project.org 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 export a function from a package and access it only by specifying the namespace?
Peng Yu wrote: Is there a way to list all the functions in a namespace? I tried the following one, but it is not working. showMethods(where=getNamespace('try.package')) No applicable functions See: http://n4.nabble.com/Check-functions-in-package-td894903.html#a894905 -- View this message in context: http://n4.nabble.com/How-to-export-a-function-from-a-package-and-access-it-only-by-specifying-the-namespace-tp932776p933251.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] polygon graph
Jose Narillos de Santos wrote: Hi all, I have a matrix dd with dates and data. i WANT to create a grpah with shade between the line and the zero axis. I´m trying to use polygon but something doesn´ t work Imagine. I want to plot g-read.table(dd.txt, col.names=c(fecha,DP)) g$fecha - as.Date(g$fecha, format=%d/%m/%Y) t-g$fecha st-length(g$DP) ft-plot(t,g$DP,type=l,ylab=DP) polygon(c(1, 1:st, st), c(0, g$USGDP, 0), col = blue) abline(h = 0, lwd = 1, col = black) If I ommit ploygon line the doc works properly (it plots a graph line). But I want to colur the area below or over the line and the zero axis. Can you guide or indicate because in this case polygon doesn´t work. I attach the two files. (You need to get your variable names straight: DP, not USGDP) As you have it, polygon is looking for values 1:28 on the x-axis. It won't find them: par('usr') will tell you what the range of x-values is on the plot. Change your line to: polygon(c(t[1],t,t[st]), c(0, g$DP, 0), col = blue) This should work (untested). -Peter Ehlers Thanks in advance for all. __ R-help@r-project.org 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@r-project.org 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] Plotting an interaction with error bars
Hello Jim, I have encountered a puzzling pattern of results using brkdn.plot(): brkdn.plot(Duration,group_val,blck,data=dpp) $mean [,1] [,2] [,3] [,4] [1,] 0.653842 0.5679849 0.477645 0.4250087 [2,] 0.653842 0.5679849 0.477645 0.4250087 [3,] 0.653842 0.5679849 0.477645 0.4250087 [4,] 0.653842 0.5679849 0.477645 0.4250087 [5,] 0.653842 0.5679849 0.477645 0.4250087 (I've omitted the $std.error matrix to save space since the pattern is the same) To verify the pattern of repetitions is not in my data I made another calculation and there is no pattern of repetition: with(dpp, ftable(by(Duration,list(group_val,blck),mean,na.rm=T))) 1 2 3 4 0.015 0.7493519 0.5125178 0.4538040 0.3498578 0.02 0.5583320 0.6234520 0.5014860 0.5001596 0.028 0.5446862 0.3600077 0.2951988 0.2842502 0.035 0.4396780 0.2335916 0.1992378 0.1661076 0.045 0.2711094 0.1305614 0.0969594 0.1491294 Is there a way to make brkdn.plot() to present this data? Thank you, dror - On Wed, Nov 4, 2009 at 12:21 PM, Dror D Lev dror.te...@gmail.com wrote: Indeed, that seems very convenient. Thanks for your work and for the help. dror - On Wed, Nov 4, 2009 at 12:17 PM, Jim Lemon j...@bitwrit.com.au wrote: On 11/04/2009 06:36 PM, Dror D Lev wrote: Thank you Jim. brkdn.plot() seems to be just the function I need. Still, I wonder if there are lists of labels of the different measures of central tendency (mct argument) and measures of dispersion (md)? Hi Dror, With brkdn.plot (and several other functions in plotrix) you can use any existing measure or even roll your own. The only limitation is that the function has to return a numeric value and must accept an na.rm argument. Jim [[alternative HTML version deleted]] __ R-help@r-project.org 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] Adding and Multiplying two Unevaluated Expressions
Benjamin Müller wrote: HI, As I'm trying to compute Taylor series, I'm having problems in adding and multiplying unevaluated expressions. I searched for a solution but found none. my Taylor function works fine for evaluating functions as you can see here: rTaylorVal=function(exp,x0,dx,n) { ls=list(x=x0) newexp=eval(exp,ls) exp0=exp for (i in 1:n){ exp0=D(exp0,x) newexp=newexp+eval(exp0,ls)/factorial(i)*dx^i } return(newexp) } Where exp is an expression like exp=expression(x^2*sin(x)), x0 is the startvalue, dx the difference between startvalue and searched value and n is the length of the series. So I tried to remove dx as a value, to get a Taylor series expression, but it doesn't work as simple multiplication (*) and accumulation (+) is not good for expressions. That's my point so far, now my question: Is it actually possible to add and/or multiply expressions, and how? Well, although R as a numerical language is not designed for these kind of things, you can do it, e.g. using a function opExpr - function(expr1, expr2, op = +){ expr - expression(a + b) expr[[1]][[1]] - as.name(op) expr[[1]][[2]] - expr1[[1]] expr[[1]][[3]] - expr2[[1]] expr } that can construct such expressions as in: opExpr(expression(x * sin(x)), expression(x^2 * sin(x))) opExpr(expression(x * sin(x)), expression(x^2 * sin(x)), *) Best wishes, Uwe Ligges Thank you so far. Benjamin Müller Geographer (B.Sc.) __ R-help@r-project.org 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] Structural Equation Models(SEM)
Hi R-colleagues. I have been using the sem(sem) function. It uses maximum likelyhood as optimizing. method. According to simulation study in Umeå Sweden (http://www.stat.umu.se/kursweb/vt07/stad04mom3/?download=UlfHolmberg.pdf Sorry it is in swedish, except the abstract) maximum likelihood is OK for large samples and normal distribution the SEM-problem should be optimized by GLS (Generalized Least Squares). So to the question: Is there any R-function that solves SEM with GLS? Ralf Finne Novia University of Applied Science Vasa Finland __ R-help@r-project.org 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] [Fwd: Re: Adding and Multiplying two Unevaluated Expressions]
Original-Nachricht Betreff:Re: [R] Adding and Multiplying two Unevaluated Expressions Datum: Tue, 01 Dec 2009 23:49:39 +0100 Von:Benjamin Müller ben_mueller...@web.de An: Rolf Turner r.tur...@auckland.ac.nz Referenzen: 20091201144125.316...@gmx.net 8e40e49f-e8fc-4fbd-8cc5-93789ffb0...@auckland.ac.nz This works fine for your example, but doesn't work as simple if there's more than these expressions. In my example this would be in line 11: newexp=as.expression(substitute(a+con1/con2*b^con3,list(a=newexp[[1]],b=expression(dx)[[1]],con1=eval(exp0,ls),con2=factorial(i),con3=1*i))) this works just fine and you can still evaluate this. thank you very much! If there's an easier way, let me know. Greets, Ben Müller Rolf Turner schrieb: On 2/12/2009, at 3:41 AM, Benjamin Müller wrote: HI, As I'm trying to compute Taylor series, I'm having problems in adding and multiplying unevaluated expressions. I searched for a solution but found none. my Taylor function works fine for evaluating functions as you can see here: rTaylorVal=function(exp,x0,dx,n) { ls=list(x=x0) newexp=eval(exp,ls) exp0=exp for (i in 1:n){ exp0=D(exp0,x) newexp=newexp+eval(exp0,ls)/factorial(i)*dx^i } return(newexp) } Where exp is an expression like exp=expression(x^2*sin(x)), x0 is the startvalue, dx the difference between startvalue and searched value and n is the length of the series. So I tried to remove dx as a value, to get a Taylor series expression, but it doesn't work as simple multiplication (*) and accumulation (+) is not good for expressions. That's my point so far, now my question: Is it actually possible to add and/or multiply expressions, and how? This may well be a case of the blind leading the partially sighted, but for what it's worth my answer is ``Yes, but it's a kludge.'' One needs to use substitute, it seems to me. E.g.: e1 - expression((x+y)^2) e2 - expression(1/(x^2 + y^2)) e3 - as.expression(substitute(a+b,list(a=e1[[1]],b=e2[[1]]))) e3 D(e3,x) D(e3,y) Older and wiser heads may provide you with better counsel. cheers, Rolf Turner ## Attention:This e-mail message is privileged and confidential. If you are not theintended recipient please delete the message and notify the sender.Any views or opinions presented are solely those of the author. This e-mail has been scanned and cleared by MailMarshalwww.marshalsoftware.com ## __ R-help@r-project.org 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] Arithmetic on multiple files
Ain't it as simple as load them (read() or read.csv()), add (+) these dataframes and thats all? you also can export them again with write(). greets, Benjamin Müller Muhammad Rahiz schrieb: Dear R-users, I'd like to perform arithmetic functions on 1000 files containing a 2000x2000 matrix. Can anyone advise? For example, File1File2 Output 1 1 1 4 4 4 5 5 5 2 2 2 +5 5 5= 7 7 7 3 3 3 6 6 6 9 9 9 Muhammad __ R-help@r-project.org 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] Reordering the results from table(cut()) by break argument
I have a vector and need to count how many data points fall inside each bin: dat - rnorm(100) breaks - -3:3 table((cut(dat, breaks))) (-3,-2] (-2,-1] (-1,0] (0,1] (1,2] (2,3] 3 13 42 30 12 0 if I reverse the breaks vector, the results remains the same: breaks - rev(breaks) table((cut(dat, breaks))) (-3,-2] (-2,-1] (-1,0] (0,1] (1,2] (2,3] 3 13 42 30 12 0 What I would like is break to also determine the order of the table output, in this case it should also be reversed, like: ( 3, 2] ( 2, 1] ( 1,0] (0,-1] (-1,-2] (-2,-3] 0 12 30 42 13 3 Thus I would like to reorder the vector using break, but I do not know how. TIA Mark ––– Mark Heckmann Dipl. Wirt.-Ing. cand. Psych. Vorstraße 93 B01 28359 Bremen Blog: www.markheckmann.de R-Blog: http://ryouready.wordpress.com __ R-help@r-project.org 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] Reordering the results from table(cut()) by break argument
try this: dat - rnorm(100) breaks - -3:3 table((cut(dat, breaks))) (-3,-2] (-2,-1] (-1,0] (0,1] (1,2] (2,3] 1 10 35 39 13 2 x - table((cut(dat, breaks))) rev(x) (2,3] (1,2] (0,1] (-1,0] (-2,-1] (-3,-2] 2 13 39 35 10 1 On Wed, Dec 2, 2009 at 12:18 PM, Mark Heckmann mark.heckm...@gmx.de wrote: I have a vector and need to count how many data points fall inside each bin: dat - rnorm(100) breaks - -3:3 table((cut(dat, breaks))) (-3,-2] (-2,-1] (-1,0] (0,1] (1,2] (2,3] 3 13 42 30 12 0 if I reverse the breaks vector, the results remains the same: breaks - rev(breaks) table((cut(dat, breaks))) (-3,-2] (-2,-1] (-1,0] (0,1] (1,2] (2,3] 3 13 42 30 12 0 What I would like is break to also determine the order of the table output, in this case it should also be reversed, like: ( 3, 2] ( 2, 1] ( 1,0] (0,-1] (-1,-2] (-2,-3] 0 12 30 42 13 3 Thus I would like to reorder the vector using break, but I do not know how. TIA Mark ––– Mark Heckmann Dipl. Wirt.-Ing. cand. Psych. Vorstraße 93 B01 28359 Bremen Blog: www.markheckmann.de R-Blog: http://ryouready.wordpress.com __ R-help@r-project.org 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org 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] Reordering the results from table(cut()) by break argument
On Dec 2, 2009, at 12:18 PM, Mark Heckmann wrote: I have a vector and need to count how many data points fall inside each bin: dat - rnorm(100) breaks - -3:3 table((cut(dat, breaks))) (-3,-2] (-2,-1] (-1,0] (0,1] (1,2] (2,3] 3 13 42 30 12 0 if I reverse the breaks vector, the results remains the same: breaks - rev(breaks) table((cut(dat, breaks))) (-3,-2] (-2,-1] (-1,0] (0,1] (1,2] (2,3] 3 13 42 30 12 0 What I would like is break to also determine the order of the table output, in this case it should also be reversed, like: Instead of reversing the breaks (which doesn't work because factors obey a very strange physics) reverse the table: rev(table((cut(dat, breaks (2,3] (1,2] (0,1] (-1,0] (-2,-1] (-3,-2] 2 21 25 35 14 3 ( 3, 2] ( 2, 1] ( 1,0] (0,-1] (-1,-2] (-2,-3] 0 12 30 42 13 3 Thus I would like to reorder the vector using break, but I do not know how. TIA Mark ––– Mark Heckmann Dipl. Wirt.-Ing. cand. Psych. Vorstraße 93 B01 28359 Bremen Blog: www.markheckmann.de R-Blog: http://ryouready.wordpress.com __ R-help@r-project.org 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. David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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 and eclipse
I found the eclipse plugin for R StatEt, hass anyone already worked with it? It's posible to put inside of java code a R script with it? Thank you -- View this message in context: http://n4.nabble.com/R-and-eclipse-tp934851p934851.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Reading comments in text file from R
When a text file starts with a few lines commented out with # can you read those line from within R. read.table ignores the comments to load the file, but it would sometimes be useful to be able to read what these comments say. Thanks, Graham __ R-help@r-project.org 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] Ridge regression
The help page clearly states that ans$coef is not on the original scale and are for use by the coef method. You also see that ans$scales gives you the scales used in the computation of ans$coef. So, to get coefficients on the original scale, you can either use coef(ans) or you can divide ans$coef by ans$scales. X1 - runif(20) X2 - runif(20) Y - 2 * X1 - 2 * X2 + rnorm(20, sd=0.1) lam - 10 ans1 - lm.ridge(Y ~ X1 + X2, lambda = lam) all.equal(ans1$coef / ans1$scales, coef(ans1)[2:3] ) Hope this helps, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvarad...@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h tml -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ravi Varadhan Sent: Wednesday, December 02, 2009 12:25 PM To: 'David Winsemius'; 'Eleni Christodoulou' Cc: r-help@r-project.org Subject: Re: [R] Ridge regression You are right that the ans$coef and coef(ans) are different in ridge regression, where `ans' is the object from lm.ridge. It is the coef(ans) that yields the coefficients on the original scale. ans$coef is the coefficient of X-scaled and Y-centered version. Here is an example that illustrates the workings of ridge regression. First let us create some data: X1 - runif(20) X2 - runif(20) Y - 2 * X1 - 2 * X2 + rnorm(20, sd=0.1) lam - 10 ans1 - lm.ridge(Y ~ X1 + X2, lambda = lam) ans1$coef coef(ans1) # Note that these two are different # Now Let us scale the variables X1 and X2 and center Y # cY - scale(Y, scale=FALSE) n - length(Y) sX1 - scale(X1) * sqrt(n/(n-1)) sX2 - scale(X2) * sqrt(n/(n-1)) require(MASS) lam - 10 ans2 - lm.ridge(cY ~ sX1 + sX2, lambda = lam) ans2$coef coef(ans2) # Now, see that the coefficients of sX1 and sX2 are the same # This is the connection! # Armed with this insight, we now compare the ans1$coef with scaled coefficients # ans1$coef c(coef(ans1)[2] * sd(X1), coef(ans1)[3] * sd(X2)) * sqrt((n-1)/n) # Now they are the same! I hope this is clear. Best, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvarad...@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h tml -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Wednesday, December 02, 2009 11:04 AM To: Eleni Christodoulou Cc: r-help@r-project.org Subject: Re: [R] Ridge regression On Dec 2, 2009, at 10:42 AM, Eleni Christodoulou wrote: Dear list, I have a couple of questions concerning ridge regression. I am using the lm.ridge(...) function in order to fit a model to my microarray data. Thus *model=lm.ridge(...)* I retrieve some coefficients and some scales for each gene. First of all, I would like to ask: the real coefficients of the model are not included in the first argument of the output but in the result of coef(model), am I right? Not exactly. coef(model) extracts the coefficients from the model but the coefficients do in the example instance I created following the help page happen to be in the first element of the model. eg: long.rr$coef GNP Unemployed Armed.Forces Population Year Employed 25.36152883.30094160.7520553 -11.6992718 -6.5403380 0.7864825 long.rr[[1]] GNP Unemployed Armed.Forces Population Year Employed 25.36152883.30094160.7520553 -11.6992718 -6.5403380 0.7864825 Moreover, what does the scale argument represent? Which is its connection with the coefficients? The R help file os not very informative for me... A plausible response to such a question might be that the help page is a sketchy substitute for the MASS book. However, I cannot find ridge regression in the table of contents or in the index of my copy, but I only have ed. 2 and the current edition is the 4th. So we will both need to wait for more knowledgeable (or with more recent editions of MASS) persons to answer that question. (And scales is not an argument, rather it's a returned value.) Thank you very much in advance, Eleni Christodoulou David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing
Re: [R] Reading comments in text file from R
On Dec 2, 2009, at 1:26 PM, Graham Smith wrote: When a text file starts with a few lines commented out with # can you read those line from within R. ?readLines read.table ignores the comments to load the file, but it would sometimes be useful to be able to read what these comments say. Thanks, Graham __ R-help@r-project.org 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. David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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] Structural Equation Models(SEM)
In the world of SEM, GLS has pretty much fallen by the wayside - I can't recall anything I've seen arguing for it's use in the past 10 years, and I also can't recall anyone using it over ML. The recommendations for non-normal distributions tend to be robust-ML, or robust weighted least squares. These are more computationally intensive, and I *think* that John Fox (author of sem) has written somewhere that it wouldn't be possible to implement them within R, without using a lower level language - or rather that it might be possible, but it would be really, really slow. However, ML and GLS are pretty similar, if you dug around in the source code, you could probably make the change (see, http://www2.gsu.edu/~mkteer/discrep.html for example, for the equations; in fact GLS is somewhat computationally simpler, as you don't need to invert the implied covariance matrix at each iteration). However, the fact that it's not hard to make the change, and that no one has made the change, is another argument that it's not a change that needs to be made. Jeremy 2009/12/2 Ralf Finne ralf.fi...@novia.fi: Hi R-colleagues. I have been using the sem(sem) function. It uses maximum likelyhood as optimizing. method. According to simulation study in Umeå Sweden (http://www.stat.umu.se/kursweb/vt07/stad04mom3/?download=UlfHolmberg.pdf Sorry it is in swedish, except the abstract) maximum likelihood is OK for large samples and normal distribution the SEM-problem should be optimized by GLS (Generalized Least Squares). So to the question: Is there any R-function that solves SEM with GLS? Ralf Finne Novia University of Applied Science Vasa Finland __ R-help@r-project.org 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. -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __ R-help@r-project.org 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] Reading comments in text file from R
Try readLines, for instance: # test.txt contents comments a,b,c 1,1,1 2,2,2 readLines(c:/test.txt,1) [1] comments read.csv(c:/test.txt,skip=1) a b c 1 1 1 1 2 2 2 2 Coen On Wed, Dec 2, 2009 at 19:26, Graham Smith myotis...@gmail.com wrote: When a text file starts with a few lines commented out with # can you read those line from within R. read.table ignores the comments to load the file, but it would sometimes be useful to be able to read what these comments say. Thanks, Graham __ R-help@r-project.org 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@r-project.org 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.