Re: [R] Different missing links on Windows in 'check' vs. 'install'
Note that on Windows only packages in the same library are checked for links, as on Windows the HTML help cannot link across libraries. (This is done under Unix via symbolic links.) By default check installs in a private library, so you may well see (correct) reports of missing links under Windows. You can check an already installed version, though. On Mon, 8 Mar 2004, Jeff Gentry wrote: Hello ... Using R-1.9.0 alpha, I'm having some problem getting a few packages to pass check under Windows - specifically with the 'missing link(s)' section of the package install phase. I started trying to track down how the missing link was showing up as in some cases I could not see why the link was considered missing. For instance, in one package it was looking for 'makeViewers' although when the packages is loaded in R, 'makeViewers' is even in the search path (by way of a dependent package which was loaded initially). Not relevant, as this is Perl code and no R process is running. In trying to figure out how these things are determiend, I noticed that in Windows there was a difference in the reported missing links when one does 'Rcmd check' vs 'Rcmd install' (or 'Rcmd install --build'). In the example above, using either of the 'install' methods results in that link not being reported as missing (and if I put in an intentionally missing link it gets picked up as such), but 'check' reports it as missing. I'm wondering what the difference in environment is between check install on Windows as that might help me to figure out why check reports these as missing links. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] (no subject)
Hi, I keep getting this error code when I try to run an R file that reads in data from another file. I know the file is there. source(C:/R_Data/typhoon.r) Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file `typhoon.txt' I hope you can help. Regards Andrew Abel _ You could be a genius! Find out by taking the IQ Test 2003. $5.50 (incl GST). Click here: http://sites.ninemsn.com.au/minisite/testaustralia/ 13 7 14 20 13 12 12 15 20 17 11 14 16 12 17 17 16 7 14 15 16 20 17 20 15 22 26 25 27 18 23 26 18 15 20 24 19 25 23 20 24 20 16 21 20 18 20 18 24 27 27 21 21 22 28 38 39 27 26 32 19 33 23 38 30 30 27 25 33 34 16 17 22 17 26 21 30 30 31 27 43 40 28 31 24 15 22 31 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Different missing links on Windows in 'check' vs. 'install'
On Mon, 8 Mar 2004, Duncan Murdoch wrote: On Mon, 8 Mar 2004 18:20:29 -0500 (EST), you wrote: In trying to figure out how these things are determiend, I noticed that in Windows there was a difference in the reported missing links when one does 'Rcmd check' vs 'Rcmd install' (or 'Rcmd install --build'). In the example above, using either of the 'install' methods results in that link not being reported as missing (and if I put in an intentionally missing link it gets picked up as such), but 'check' reports it as missing. I'm wondering what the difference in environment is between check install on Windows as that might help me to figure out why check reports these as missing links. This is something we should fix. I haven't checked the code, but I believe the rule is that check will only find links to base packages, but install will find links to any package installed on the system. No, both will find links in the same library as installing into (plus those which are fixed up on installation, e.g. to the base package). Several of us have looked for years for a fix, and this is the best scheme we have come up with. You can't put in absolute paths in the HTML as e.g. a private library may be used with more than one version of R (or R may be updated later). Short of adding symbolic links to Windows (and getting browsers to follow them), how do you propose `we should fix' it? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Decision Trees
Hi, -Original Message- WEKA includes a re-implementation of the ideas behind C4.5, but not C4.5. If my memory serves me right, WEKA people called this re-implementation J4.8. Kevin Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre University of Auckland New Zealand __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Monte Carlo p-value (was question)
1/(B+1) is the significance level of the Monte Carlo test if the data give the most extreme value. (E.g. Ripley, 1987, p. 171.) This is a calculation, not a convention, and assumes a continuously distributed statistic. On Mon, 8 Mar 2004, Spencer Graves wrote: What is the standard convention for a Monte Carlo p-value when the observed outcome is more extreme than all simulations? The example provided by Cédric Fine produced a Monte Carlo p-value, according to Kjetil Halvorsen, of 2.2e-16 (based on 2000 replicates). This seems inappropriate to me. By reading the code, I found that for this case, PVAL - sum(tmp$results = STATISTIC)/B where STATISTIC is the observed chi-square while tmp$results is a vector of length B of chi-squares from Monte Carlo simulated tables with the same marginals. Thus, PVAL ranges over seq(0, 1, length=(B+1)). For the observed table, presumably, PVAL = 0. The function chisq.test apparently returns an object of class htest, and print.htest calls format.pval(x$p.value, digits = digits), for which format.pval(0, 4) is 2.2e-16. Can someone provide an appropriate reference or sense of the literature on the appropriate number to report for a Monte Carlo p-value when the observed is more extreme than all the simulations? A value of 0 or 2.2e-16 violates my sense of the logic of this situation. If the appropriate number is 0.5/B, then the line PVAL - sum(tmp$results = STATISTIC)/B could be followed immediately by something like the following: if(PVAL==0) PVAL - 0.5/B Comments? Best Wishes, Spencer Graves [EMAIL PROTECTED] wrote: On 8 Mar 2004 at 16:38, [EMAIL PROTECTED] wrote: I do not manage to make a Fisher´s exact test with the next matrix : You can consider using chisq.test() with the argument sim=TRUE: mat - matrix(scan(), 7, 12, byrow=TRUE) 1: 130129002 5 8 6 13:033000050 3 0 0 25:00000 10000 010 0 37:02026 14006 010 6 49:050007000 2 8 0 61:001947214 212 5 73:060000000 5 1 3 85: Read 84 items chisq.test(mat, sim=TRUE) Pearson's Chi-squared test with simulated p-value (based on 2000 replicates) data: mat X-squared = 218.3366, df = NA, p-value = 2.2e-16 Kjetil Halvorsen [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,]130129002 5 8 6 [2,]033000050 3 0 0 [3,]00000 10000 010 0 [4,]02026 14006 010 6 [5,]050007000 2 8 0 [6,]001947214 212 5 [7,]060000000 5 1 3 but I do not understand why it does not work since I obtain the next error message : fisher.test(enfin.matrix) Error in fisher.test(enfin.matrix) : Bug in FEXACT: gave negative key thank you for considering my application cédric finet __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Am failing on making lagged residual after regression
If you have missing data in your data frame and want residuals for all observations, you need to use na.action=na.exclude, not the default na.omit. As for lag, its description says Description: Compute a lagged version of a time series, shifting the time base back by a given number of observations. and you don't have a time series. It works by shifting the time base for a time series, not by moving the contents of a vector. On Mon, 8 Mar 2004, Ajay Shah wrote: Folks, I'm most confused in trying to do something that (I thought) out to be mainstream and straightforward R. :-) Could you please help? I am doing an ordinary linear regression. My goal is: After a regression, to make residuals, and make a new variable which is the lagged residuals (lagged by 1). I will use this variable in a 2nd stage regression (for an error-correcting model). This sounds simple and reasonable, and should be right up R's alley, but I am just not able to do this. Can I please show you the steps which I'm trying and failing in? I start with: m = lm(NNDA ~ NFA + NFA.x.d1 + NFA.x.d2 + IIP.n + CRR, D.f) e = residuals(m) print(e) 34 35 36 37 38 39 -5073.24843 -4210.27886 -8218.01782 -1489.10583 -4426.11738 -11332.56052 (lines deleted) 64 65 66 67 68 69 8362.93776 7564.14324 2311.41208 7660.00638 -1271.04645 -10917.29418 (lines deleted) 160 161 162 163 164 165 3858.94591 -11783.04370 -21438.33646 1859.49628 -4988.82853 -25172.43241 Here, the residuals only started at the 34th observation owing to missing data in my data frame. This is correct and sensible. The dataset is 167 observations, but 166 and 167 are also missing data and dropped. I tried to use lag(e,1) to make a new vector and failed. I think I am just not understanding the R concept of lag(). In my notion of a lagged vector, I want a vector f where f[35] is e[34], i.e. is the first residual above of -5073.24843. This is just not what I get by saying lag(e,1) - I am just not understanding lag(). I would be very happy if someone could educate me on how to utilise lag(). Okay, I try to get my way in a different way: print(T) [1] 167 f = numeric(T) f[1] = NA f[2:T] = e[1:(T-1)] This looks reasonable? I thought this should do the trick. I am hand-initialising a T-length vector with NA in the 1st elem, and I copy out the values of e[] from 1 till 166 into f[2:T]. I thought this should give me a lagged e. It doesn't -- print(f) [1] NA -5073.24843 -4210.27886 -8218.01782 -1489.10583 (lines deleted) [131] 1859.49628 -4988.82853 -25172.43241 NA NA (lines deleted) [166] NA NA I thought Okay, what seems to be happening is that the e[1] that I have is `actually' the e[34] of my thoughts. So I try: f=rep(NA, T) # zap out f f[35:T] = e[34:(T-1)] # copy out useful stuff into 35..T print(f) [1] NA NA NA NA NA (lines deleted) [31] NA NA NA NA 7660.00638 [36] -1271.04645 -10917.29418 -1.60144 -1597.98355 -1066.01901 (lines deleted) [131] 1859.49628 -4988.82853 -25172.43241 NA NA (lines deleted) [166] NA NA This is wrong!! Recall (from upstairs) that e[34] was -5073.24843. That value seems to have mysteriously vanished. Instead, the first non-NA in f - which is f[35] - is 7660.00638, which (incidentally) was e[67]. I just don't know how that value got here. And, the values in f[] seem to peter out at 133! After 133, they are all NA until the end. I guess I'm _just_ not understanding what is the animal that is returned by residual(lm()). I know I am missing something basic, because lots of people must be doing what I am trying: I.e. to run a regression, extract a residual, lag it, and use it for a 2nd stage regression. I know that the vector e (returned by residual(lm())) is different from a simple vector, for when I say: print(f[35]) [1] 7660.006 print(e[35]) 68 -1271.046 the two animals seem to be different. I don't understand e[35] - why is it not just a number - there seems to be some index tagging along? How do I get at the pure numbers of the residuals? Thanks much, -ans. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list
[R] maxima
Dear all, suppose I have a bi-variate function f(x,y), I want to find the maxima. I define x and y vector, and get matrix z=f(x,y). how can I get which (x0,y0) makes z become the maxima? I can do two loops to get the x0 and y0, but I think there may exist a function to do this. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] SVM unbalanced classes
Hi! I am using R 1.8.1 and the svm of the e1071 package for classification. The problem is that I have unbalanced classes e.g. the first one is much bigger than the second one and therfore the svm is biased to the first class. If I manually adjust the class size the bias disappears. The question is then how to include this unequal class distribution to the svm (e.g. via wheights or costs)? Yours, Frank -- Frank G. Zoellner AG Angewandte Informatik Technische Fakultat Universitat Bielefeld phone: +49(0)521-106-2951 fax: +49(0)521-106-2992 email: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] (no subject)
Make sure you either use full path to `typhoon.txt' as you did with `typhoon.r', or setwd() to the directory where `typhoon.txt' lives before reading it. [Please use an informative subject for your message.] Andy From: Andrew Abel Hi, I keep getting this error code when I try to run an R file that reads in data from another file. I know the file is there. source(C:/R_Data/typhoon.r) Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file `typhoon.txt' I hope you can help. Regards Andrew Abel _ You could be a genius! Find out by taking the IQ Test 2003. $5.50 (incl GST). Click here: http://sites.ninemsn.com.au/minisite/testaustr alia/ -- Notice: This e-mail message, together with any attachments,...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] (no subject)
May be you aren't on the right working dir: getwd(),setwd(). Your R-script are able to find the thyphoon.txt path? Best! A.S. Alessandro Semeria Models and Simulations Laboratory Montecatini Environmental Research Center (Edison Group), Via Ciro Menotti 48, 48023 Marina di Ravenna (RA), Italy Tel. +39 544 536811 Fax. +39 544 538663 E-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] SVM unbalanced classes
Hi, SVM have got the option class.weights to put the apriori-distribution for your target variable. To oversample, or undersample a specific class you have imho write a own function!? Perhaps it helps ,christian Am Dienstag, 9. März 2004 11:29 schrieb Frank Gerrit Zoellner: Hi! I am using R 1.8.1 and the svm of the e1071 package for classification. The problem is that I have unbalanced classes e.g. the first one is much bigger than the second one and therfore the svm is biased to the first class. If I manually adjust the class size the bias disappears. The question is then how to include this unequal class distribution to the svm (e.g. via wheights or costs)? Yours, Frank __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Different missing links on Windows in 'check' vs. 'install'
On Tue, 9 Mar 2004 08:03:44 + (GMT), you wrote: No, both will find links in the same library as installing into (plus those which are fixed up on installation, e.g. to the base package). Several of us have looked for years for a fix, and this is the best scheme we have come up with. You can't put in absolute paths in the HTML as e.g. a private library may be used with more than one version of R (or R may be updated later). Short of adding symbolic links to Windows (and getting browsers to follow them), how do you propose `we should fix' it? Here's a proposal: All of check and build and install should default to the same library location. Check and build aren't meant to be permanent installs, so if the package already exists there, it'll have to be temporarily moved out of the way. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] asking for information
Dear Sir: I am interesting in to use some R functions in some of our developments. But I have a problem which I have not found information in R documentation, for that I ask for help. Can I to call R functions from a C (or another language) program ?. ANd if the answer if yes, could you help me informe me where I can found information to respect? I will be very thanks to you, if you could help me Thanks a lot Best Regards - Miguel Ángel Gómez-Nieto University of Córdoba Dept. Computing and Numerical Analysis Software and Knowledge Engineering and Database Researh Group Campus Universitario de Rabanales Building C2, Plant 3. E-14071 Córdoba (Spain) Phone: +34-957-212082 Fax: +34-957-218630 [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] levelplot problems !!!
Dear R users, I have changed my R version to the new 1.8.1 and some problems appears when using the previous levelplot code. This is a simple example: a -1:10 b -11:20 j - rnorm(100) grid-expand.grid(a = a, b = b) levelplot(j~a*b, grid) Normaly in my previous vs this was suffice to produce the levelplot. Now, an empty R graphics device appears with the following error message: Error in grid.pack(frame = key.gf, row = 1, col = 1, grob = grid.rect(x =rep(0.5, :unused argument(s) (frame ...) Are there any solution? Thanks in advance H -- . Hernan J. Dopazo Bioinformatica. CNIO c/ Melchor Fernández Almagro 3 28029, Madrid, España Tfn: (34) 91 224 69 00 ext: 2428 Fax: (34) 91 224 69 23 http://bioinfo.cnio.es . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] error() and C++ destructors
I am sending this reply on behalf of Erik (who is not a member of this list). - Lennart -Original Message- From: Källen, Erik Sent: 9 mars 2004 11:37 To: Borgman, Lennart Subject: RE: [R] error() and C++ destructors I would do something like: class error_exception { public: error_exception(const string str) : msg(str) {} string msg; }; void my_error(const string str) { throw error_exception(str); } int real_my_method(int a, char *b) { /* some code... */ return 0; } // this is the public method: int my_method(int a, char *b) { try { return real_my_method(a, b); } catch (error_exception e) { error(e.msg); } } You could probably even create a macro like: #define R_METHOD_IMPL(rettype, name, paramlist) \ rettype real_##name paramlist; \ rettype name paramlist { \ try { \ return real_##name paramlist; \ } \ catch (error_exception e) { \ error(e.msg); \ } \ } \ rettype real_##name paramlist You would use this macro like: R_METHOD_IMPL(int, my_method, (int a, char *b)) { // source code here } I think it would work, but I'm not sure (untested). /Erik Källén -Original Message- From: Vadim Ogranovich [mailto:[EMAIL PROTECTED] Sent: 2 mars 2004 22:00 To: R Help List Subject: [R] error() and C++ destructors Hi, I am writing C++ functions that are to be called via .Call() interface. I'd been using error() (from R.h) to return to R if there is an error, but then I realized that this might be not safe as supposedly error() doesn't throw an exception and therefore some destructors do not get called and some memory may leak. Here is a simple example extern C void foo() { string str = hello; error(message); } The memory allocated for str is leaked. Did anyone think about this and find a way to work around the problem? Thanks, Vadim [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] asking for information
Hola, Yes you can call R from C and viceversa, you should read the manual Writing R extensions: available in the section manuals from the r-project website http://cran.r-project.org/doc/manuals/R-exts.pdf Suerte, Angel Miguel Ángel Gómez-Nieto wrote: Dear Sir: I am interesting in to use some R functions in some of our developments. But I have a problem which I have not found information in R documentation, for that I ask for help. Can I to call R functions from a C (or another language) program ?. ANd if the answer if yes, could you help me informe me where I can found information to respect? I will be very thanks to you, if you could help me Thanks a lot Best Regards - Miguel Ángel Gómez-Nieto University of Córdoba Dept. Computing and Numerical Analysis Software and Knowledge Engineering and Database Researh Group Campus Universitario de Rabanales Building C2, Plant 3. E-14071 Córdoba (Spain) Phone: +34-957-212082 Fax: +34-957-218630 [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] error() and C++ destructors
And maybe I stressed Erik a bit, because he corrected himself some minutes later (when I was no longer looking over his shoulder). Again on behalf of Erik. - Lennart -Original Message- From: Källen, Erik Sent: 9 mars 2004 13:40 To: Borgman, Lennart Subject: RE: [R] error() and C++ destructors Whoops. This code leaks memory for the exception. It would be better to throw a pointer: void my_error(const string str) { throw new error_exception(str); } int my_method(int a, char *b) { try { return real_my_method(a, b); } catch (error_exception *pe) { static char error_msg[SOME_LARGE_NUMBER]; strncpy(error_msg, pe-msg.c_str(), sizeof(error_msg)); delete pe; error(error_msg); } } -Original Message- From: Borgman, Lennart Sent: 9 mars 2004 13:35 To: '[EMAIL PROTECTED]' Subject: RE: [R] error() and C++ destructors I am sending this reply on behalf of Erik (who is not a member of this list). - Lennart -Original Message- From: Källen, Erik Sent: 9 mars 2004 11:37 To: Borgman, Lennart Subject: RE: [R] error() and C++ destructors I would do something like: class error_exception { public: error_exception(const string str) : msg(str) {} string msg; }; void my_error(const string str) { throw error_exception(str); } int real_my_method(int a, char *b) { /* some code... */ return 0; } // this is the public method: int my_method(int a, char *b) { try { return real_my_method(a, b); } catch (error_exception e) { error(e.msg); } } You could probably even create a macro like: #define R_METHOD_IMPL(rettype, name, paramlist) \ rettype real_##name paramlist; \ rettype name paramlist { \ try { \ return real_##name paramlist; \ } \ catch (error_exception e) { \ error(e.msg); \ } \ } \ rettype real_##name paramlist You would use this macro like: R_METHOD_IMPL(int, my_method, (int a, char *b)) { // source code here } I think it would work, but I'm not sure (untested). /Erik Källén -Original Message- From: Vadim Ogranovich [mailto:[EMAIL PROTECTED] Sent: 2 mars 2004 22:00 To: R Help List Subject: [R] error() and C++ destructors Hi, I am writing C++ functions that are to be called via .Call() interface. I'd been using error() (from R.h) to return to R if there is an error, but then I realized that this might be not safe as supposedly error() doesn't throw an exception and therefore some destructors do not get called and some memory may leak. Here is a simple example extern C void foo() { string str = hello; error(message); } The memory allocated for str is leaked. Did anyone think about this and find a way to work around the problem? Thanks, Vadim [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Different missing links on Windows in 'check' vs. 'install'
On Tue, Mar 09, 2004 at 12:38:33PM +, Prof Brian Ripley wrote: On Tue, 9 Mar 2004, Duncan Murdoch wrote: On Tue, 9 Mar 2004 08:03:44 + (GMT), you wrote: No, both will find links in the same library as installing into (plus those which are fixed up on installation, e.g. to the base package). Several of us have looked for years for a fix, and this is the best scheme we have come up with. You can't put in absolute paths in the HTML as e.g. a private library may be used with more than one version of R (or R may be updated later). Short of adding symbolic links to Windows (and getting browsers to follow them), how do you propose `we should fix' it? Here's a proposal: All of check and build and install should default to the same library location. Check and build aren't meant to be permanent installs, so if the package already exists there, it'll have to be temporarily moved out of the way. You may not own the main library and so not have permission to install/check/build there. If you do, you can use check on an installed copy of the package. As for build, this is one of the reasons why Rcmd INSTALL --build was needed, as that installs in the standard place and then wraps up the installed copy. Yes, but for automated checking of many packages (60+ in Bioconductor and over 200 in CRAN) it would be nice to be able to separate out the real issues from the supposed ones. Perhaps we need a mechanism to generate some sort of database of these (which is updated/modified by R INSTALL, for example). Then R CMD check could generate an index file of resolved/supplied links for the library path that R is using, generally $R_HOME/library, and then we simply compare against that. It seems that we are currently making the wrong comparison. What might make more sense (it seems to me) is to check and see if the links are resolved only against base R + any packages in the depends/suggests field of the package being checked. Since these are the ones that we will try to ensure are available at run time. References outside of that set could be warnings. Here we are not trying to physically resolve the links, just make sure that they are resolvable given the version of R and the package dependencies. Robert -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- +---+ | Robert Gentleman phone : (617) 632-5250 | | Associate Professor fax: (617) 632-2444 | | Department of Biostatistics office: M1B20| | Harvard School of Public Health email: [EMAIL PROTECTED]| +---+ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] memory problem
How many chips you can read is a function of how much RAM you have and what chip it is. On a unix/linux box you will be able to read in and process 143 of the HG-u95aV2 chips if you have about 2 Gb RAM. For the larger U133A chips (RAE/MOE are about the same size), you will probably need almost twice as much RAM. For the new version 2 chips you will likely need about four times as much RAM (yep, that's 8 Gb!). Some information about memory requirements and timings can be found here: http://stat-www.berkeley.edu/users/bolstad/ComputeRMAFAQ/size.html HTH, Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 Joshi, Nina (NIH/NCI) [EMAIL PROTECTED] 03/08/04 12:15PM I am trying to upload into R 143 Affymetrix chips onto using R on the NIH Nimbus server. I can load 10 chips without a problem, however, when I try to load 143 I receive a error message: cannot create a vector of 523263 KB. I have expanded the memory of R as follows: R --min-vsize=10M --max-vsize=2500M --min-nsize=10M -max-nsize=50M (as specified in help in R). After running this command the memory in R is as follows: Used (Mb) gctrigger(Mb)limit (Mb) Ncells 513502 13.810485760280.01400 Vcells 142525 1.1162625696 1240.82500 However, I am still getting the error cannot create a vector of 523263 KB. Any suggestions/ideas? Thanks., Nina Nina Joshi, PhD NIH/NCI/ Genetics Branch National Naval Medical Center, Bldg. 8, Rm. 5101 8901 Wisconsin Ave. Bethesda, MD. 20889-5101 (301) 435-5436 - phone (301) 496-0047 - fax [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] SVM unbalanced classes
You might consider using the `weight' argument of svm(). Best, David. Hi! I am using R 1.8.1 and the svm of the e1071 package for classification. The problem is that I have unbalanced classes e.g. the first one is much bigger than the second one and therfore the svm is biased to the first class. If I manually adjust the class size the bias disappears. The question is then how to include this unequal class distribution to the svm (e.g. via wheights or costs)? Yours, Frank -- Frank G. Zoellner AG Angewandte Informatik Technische Fakultat Universitat Bielefeld phone: +49(0)521-106-2951 fax: +49(0)521-106-2992 email: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] levelplot problems !!!
Hernan == Hernan Dopazo [EMAIL PROTECTED] on Tue, 9 Mar 2004 12:46:51 +0100 writes: Hernan Dear R users, Hernan I have changed my R version to the new 1.8.1 and some problems appears when Hernan using the previous levelplot code. Hernan This is a simple example: after library(lattice) ! Hernan a -1:10 Hernan b -11:20 Hernan j - rnorm(100) Hernan grid-expand.grid(a = a, b = b) Hernan levelplot(j~a*b, grid) This works fine for me. Hernan Normaly in my previous vs this was suffice to Hernan produce the levelplot. Now, an empty R graphics Hernan device appears with the following error message: Hernan Error in grid.pack(frame = key.gf, row = 1, col = 1, Hernan grob = grid.rect(x =rep(0.5, : unused argument(s) Hernan (frame ...) I assume that you somehow managed to use an old version of grid or lattice instead of the ones that ``come with R 1.8.1''. Can you try to look at .path.package() after library(grid) ; library(lattice) and make sure that both packages come from the same place as base e.g. ? Regards, Martin Maechler [EMAIL PROTECTED] http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] levelplot problems !!!
On Tuesday 09 March 2004 05:46, Hernan Dopazo wrote: Dear R users, I have changed my R version to the new 1.8.1 and some problems appears when using the previous levelplot code. This is a simple example: a -1:10 b -11:20 j - rnorm(100) grid-expand.grid(a = a, b = b) levelplot(j~a*b, grid) Normaly in my previous vs this was suffice to produce the levelplot. Now, an empty R graphics device appears with the following error message: Error in grid.pack(frame = key.gf, row = 1, col = 1, grob = grid.rect(x =rep(0.5, :unused argument(s) (frame ...) This shouldn't happen (and doesn't happen for me). What OS and what version of lattice are you using ? Deepayan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Package cclust error
Hello, here is my problem, After looking at the mail archives, I found a description of the error I get when I use this package. At first I even tought that they were showing how to solve it. But the thing is that by saying the programmer forgot drop=FALSE doesn't show me how I should get rid of the problem I have looked inside the package very quickly and I found three files, I am not sure what to do to fix this (the problem is describe bellow) I would be very happy to have someone show me how to solve my problem Thanks a lot Sébastien Durand On Wed, 20 Feb 2002, David Wartel wrote: I have to solve a clustering problem. My first step is to determinate the number of clusters, that's why I 'm using ...snip... ... number of clusters. A function is already implemented in R to calculate this index : clustIndex(cl,x, index=calinski) Where is that from? It's not part of R -- package cclust, perhaps? where cl is the result of a clustering method , for instance: cclust(x,k,itermax,verbose=TRUE,method=kmeans) My probleme is that I can't calculate the Calinski's index when a cluster contains only one datapoint : Error in cov(x[cluster == l, ]) : supply both x and y or a matrix-like x The programmer forgot drop=FALSE, it would seem. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] New Ranking Scheme - Help
Hi all, I am a biostatistician and I have developed my own ranking system for clinical data. I would like to test the efficiency of it w.r.t. to other ranking systems. I would like to simulate the data and after assigning ranks to my observed scores(after neglecting dropouts), observe the type I error. If I want to do a Kruuskal Wallis type of test, what test statistic should I use to test for a difference of delta between the two groups (I know delta since the data is generated with that difference). The default K-W test statistics test for a NULL difference and I want to see how frequently my ranking system rejects the correct null hypothesis of a delta difference. (So my data is now in 2 arrays of unequal lengths due to dropouts, which have the ranks for drug and placebo.) Thank you in advance for your help. ~S __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] aic calculation
hello, could somebody refer me to the reason R uses -2*loglik + 2*(#param)+2 to calculate AIC? thank you -- Stoyan Iliev __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Significance of differences in RMS?
Greetings, I have the following problem: I want to compare a parameter trajectory, i.e. a series of real numbers (representing equidistant samples of a time-varying parameter) produced by some model, to a reference trajectory, measured from the real world, in order to get a rating of how good the model that produced the first trajectory is. Ok, so I use the RMS of the difference between the two trajectories at each sample. Then I have another model, producing another trajectory, leading to another RMS-value. Good. Now I want to clame that the two models are equally good on the basis of the RMS-values being similar, and require some sort of significance test to support this claim. But I can't assume normal distribution in this case since the values are squared (or can I?) so with my limited knowledge of statistics I'm stuck... Any help is appreciated! regards - Jonas PS I apologize for posting a question entirely unrelated to R but any R-related answers are of course welcome! -- Jonas Beskow, Ph.D. Tel: +46 8 790 8965 Centre for Speech TechnologyFax: +46 8 790 7854 KTH[EMAIL PROTECTED] SE-10044 Stockholm, Swedenwww.speech.kth.se/~beskow __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to ascertain the number of clusters automatically?
Hi, everyone, There is many small cells which can be classified into several big cells from the scanned image. K-means clustering does not work well in this condition. I have done hierarchical clustering on cells successfully which uses shortest distance between classes. The number of clusters is about 3, 4, 5, 6, 7 generally. One can ascertain the number of clusters visually. But because there are thousands of images to be clustered. So it is humdrum to me. I want to know if there are any methods that can be used to ascertain the number of clusters automatically, especially in this case, only several clusters? Thank you very much! Best, Fucang __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] aic calculation
AIC is calculated in many places in R, but I do not believe any use that formula. Here is a guess as to your confusion: in linear models there are p coefficients plus sigma^2 to be estimated and hence there is often an extra 2 associated with the scale parameter. For example, in gaussian()$aic function (y, n, mu, wt, dev) sum(wt) * (log(dev/sum(wt) * 2 * pi) + 1) + 2 Beyond that, additive constants do not matter in comparing AIC between models and the defn of log-likelihood is only up to an additive constant. So sometimes calculations omit constants common to all models: extractAIC.lm does, for example. On Tue, 9 Mar 2004, Stephen Dicey wrote: could somebody refer me to the reason R uses -2*loglik + 2*(#param)+2 to calculate AIC? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] aic calculation
R calculates AIC = -2*loglik + 2*(#param) but you probably missed the variance parameter when counting the parameters. Jens Schumacher -- Dr. Jens Schumacher Max-Planck-Institut f. Biogeochemie Winzerlaer Str. 10 D-07745 Jena Germany Tel: +49 (0)3641/576181 Fax: +49 (0)3641/577100 email: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] use of split lines in ess
Hi all I am very astonished that R generates a syntax error when I want to split up a line with a backslash, which usually works in any shell script. R itself generates the + symbols at the beginning of following lines in a splitted line so I've tried with them as well, but also without success. Searching in the h-help archive did not reveal any answer either. How is this accomplished? Thanks, David __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] aic calculation
That quantity is called the Akaike Information Criterion. It dates back to original work of Akaike. For more recent discussions and citations to earlier literature see, e.g.: Brian Ripley (1996) Pattern Recognition and Neural Networks (Cambridge U. Pr.) Burnham and Anderson (2002) Model Selection and Multimodel Inference (Springer). The latter contains errors, as Prof. Ripley indicated in earlier posts to this listserve. However, it seems for me to still be useful. hope this helps. spencer graves Stephen Dicey wrote: hello, could somebody refer me to the reason R uses -2*loglik + 2*(#param)+2 to calculate AIC? thank you -- Stoyan Iliev __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] use of split lines in ess
David Andel [EMAIL PROTECTED] writes: I am very astonished that R generates a syntax error when I want to split up a line with a backslash, which usually works in any shell script. One way to diminish the astonishment factor when using software is to try reading the documentation. :-) The backslash in part of the R syntax (except within quoted strings) so it generates a syntax error. If you want to force continuation of an expression to the next input line then ensure that the partial expression that you type is not syntactically complete. Often you can use { or ( on the first line with the pairing } or ) on the last line. R itself generates the + symbols at the beginning of following lines in a splitted line so I've tried with them as well, but also without success. Searching in the h-help archive did not reveal any answer either. How is this accomplished? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Different missing links on Windows in 'check' vs. 'install'
On Tue, 9 Mar 2004 12:38:33 + (GMT), Prof Brian Ripley [EMAIL PROTECTED] wrote : On Tue, 9 Mar 2004, Duncan Murdoch wrote: Here's a proposal: All of check and build and install should default to the same library location. Check and build aren't meant to be permanent installs, so if the package already exists there, it'll have to be temporarily moved out of the way. You may not own the main library and so not have permission to install/check/build there. If you do, you can use check on an installed copy of the package. As for build, this is one of the reasons why Rcmd INSTALL --build was needed, as that installs in the standard place and then wraps up the installed copy. This isn't a revolutionary proposal, I'm mainly suggesting that we regularize it a bit. If I want to build a binary package, I should be able to expect to use Rcmd build --binary. If Rcmd INSTALL --build does a better job, then shouldn't Rcmd build --binary be modified to do the same? The only new part of my suggestion is to move existing packages out of the way so that the new one can be installed temporarily. As you say, this won't always be possible, but if Rcmd INSTALL --build could work, then it should be possible to do a temporary version of the same thing. So here's a refinement of my suggestion: By default, Rcmd build and Rcmd check should attempt to do their work in the default library install location. If that fails, then they could fail with a message telling you to use a --library= option, or they could automatically try working in a temporary directory, with a warning that this may produce suboptimal results. In either case, if a package with the given name is already installed, they should attempt to rename it to a temporary name to get it out of the way. If this fails, then proceed as above. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Error message - what does it mean???
Hi, I am trying to calculate mahalanobis distances for a matrix x with n*p variables. I am getting the following error: md2 - mahalanobis(x, center, cov) Error in solve.default(cov, tol = tol.inv) : system is computationally singular: reciprocal condition number = 2.11165e-009 What does it means? Thank you so much for any help, Monica __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R and tmp directroy
Hi all, When I start R, it gives mkdir: Ne peut créer le répertoire `/home/mart/tmp/Rtmp11729'.: No such file or directory (I specify that my home path is /home/mart and the R version is 1.7.1) How I have to configure R to use the directory /tmp instead of /home/mart/tmp ? What is utility of this directory tmp for R? Thanks, Olivier __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Error message - what does it mean???
On Tue, 9 Mar 2004, Monica Palaseanu-Lovejoy wrote: Hi, I am trying to calculate mahalanobis distances for a matrix x with n*p variables. I am getting the following error: md2 - mahalanobis(x, center, cov) Error in solve.default(cov, tol = tol.inv) : system is computationally singular: reciprocal condition number = 2.11165e-009 What does it means? Error messages usually mean what they say, and it hard to see what you mind to understand here. Whatever you supplied for `cov' is a singular matrix to the default tolerance, described on the help page. If you know what is going on with your data, you could reduce the argument `tol.inv'. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to use conditional statements to handle exceptions?
Hello, I have a problem to handle the following statements. for(i in [1:3]) { file=paste(file, i, .dat) bb - read.table(file) x11() plot(bb) dev.off() } When the input .dat file is empty, the program stops running and an error message appears. Could someone tell me how to handle this exception? Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Decision Trees
Thanks for the insight. I think we will try both CART (rpart) and C4.5 (J4.8) and see what happens. As always, the R community is so helpful. Thanks, Ben -Original Message- From: Ko-Kang Kevin Wang [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 09, 2004 12:08 AM To: 'Prof Brian Ripley'; STABLER Benjamin Cc: [EMAIL PROTECTED] Subject: RE: [R] Decision Trees Hi, -Original Message- WEKA includes a re-implementation of the ideas behind C4.5, but not C4.5. If my memory serves me right, WEKA people called this re-implementation J4.8. Kevin Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre University of Auckland New Zealand __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] use of split lines in ess
it looks like you are wondering about something with ESS. Could you be more precise about the exact conditions? Also, the ess-help mailing list might be a better place to post. Version #'s of R, and if it is an ESS problem, ESS and (X)Emacs would be useful. David Andel [EMAIL PROTECTED] writes: I am very astonished that R generates a syntax error when I want to split up a line with a backslash, which usually works in any shell script. R itself generates the + symbols at the beginning of following lines in a splitted line so I've tried with them as well, but also without success. Searching in the h-help archive did not reveal any answer either. How is this accomplished? Thanks, David __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to use conditional statements to handle exceptions?
Take a look at try(). -roger Susan Lin wrote: Hello, I have a problem to handle the following statements. for(i in [1:3]) { file=paste(file, i, .dat) bb - read.table(file) x11() plot(bb) dev.off() } When the input .dat file is empty, the program stops running and an error message appears. Could someone tell me how to handle this exception? Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Creating its own family
Hello, I would like to create my own family for glm modelling If we consider a matrix Y, I would like to model Yij/var(Yj) with an inverse variance link. I have create my own family inspired by the negative.binomial of MASS: # myfamily=function (varcol) { env - new.env(parent = .GlobalEnv) assign(.varcol,varcol,envir=env) famname=myfamily link=inv col var linkfun=function(.varcol,mu){mu/(.varcol)} linkinv=function(.varcol,eta){eta*(.varcol)} variance - function (mu) rep.int(1, length(mu)) validmu - function (mu) TRUE dev.resids - function (y, mu, wt) wt * ((y - mu)^2) aic - function (y, n, mu, wt, dev) sum(wt) * (log(dev/sum(wt) * 2 * pi) + 1) + 2 mu.eta=function (eta) rep.int(1, length(eta)) initialize - expression({ n - rep.int(1, nobs) mustart - y }) environment(variance) - environment(validmu) - environment(dev.resids) - environment(aic) - env structure(list(family = famname, link = link, linkfun = linkfun, linkinv = linkinv, variance = variance, dev.resids = dev.resids, aic = aic, mu.eta = mu.eta, initialize = initialize, validmu = validmu), class = family) } # But it does not work when I try it Y=matrix(runif(50),10,5) glm(as.vector(t(Y))~x,family=myfamily(rep(apply(Y,2,var),10))) Error in family$linkfun(mustart) : Argument mu is missing, with no default Hope that someone could help me, Thanks in advances, Sincerely. Stéphane DRAY -- Département des Sciences Biologiques Université de Montréal, C.P. 6128, succursale centre-ville Montréal, Québec H3C 3J7, Canada Tel : 514 343 6111 poste 1233 E-mail : [EMAIL PROTECTED] -- Web http://www.steph280.freesurf.fr/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] how to use conditional statements to handle exceptions?
If you mean to put a check in to see if the file exists then something like this would work: for(i in 1:3){ aFile - paste(file, i, .dat, sep = ) if(file.exists(aFile) == T){ bb - read.table(aFile, header = F) x11() plot(bb) dev.off() } } If you mean that you want to check to see that it has data in it you could ammend the if statement to something like if(nrow(aFile) 0)... HTH, Andy __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R and tmp directroy
Finally, i found the answer for my question... it is only necessary to add setenv TMPDIR /tmp/ in my .cshrc Martin Olivier wrote: Hi all, When I start R, it gives mkdir: Ne peut créer le répertoire `/home/mart/tmp/Rtmp11729'.: No such file or directory (I specify that my home path is /home/mart and the R version is 1.7.1) How I have to configure R to use the directory /tmp instead of /home/mart/tmp ? What is utility of this directory tmp for R? Thanks, Olivier __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- - Martin Olivier INRA - Unité protéomique LIRMM - IFA/MAB 2, Place Viala 161, rue Ada 34060 Montpellier Cédex 1 34392 Montpellier Cédex 5 Tel : 04 99 61 26 14 Tel : O4 67 41 86 71 [EMAIL PROTECTED] [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] error() and C++ destructors
One shortcoming of Erik's solution is that it can only catch the exceptions of type error_exception. For example it won't work if my code calls some third party library that can throw exceptions of some other types. In case it's of interest to someone here is the boilerplate that I ended up using (note the similarity between my errMsg and error_message from Erik's solution): extern C SEXP foo(SEXP x) { int hasFailed=0; char errMsg[2048]; // NO C++ objects above this line try { // do the work ... } cach (std::exception e) { hasFailed = 1; strncopy(errMsg, e.what(), sizeof(errMsg)); } catch (OtherException e) { hasFailed = 1; ... } // NO C++ objects below this line if (hasFailed) { error(errMsg); } return x; } One thing I don't like about my solution is that I need to remember to set hasFailed in each and every catch block (and I often remember to forget these sort of things :-) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 09, 2004 4:59 AM To: [EMAIL PROTECTED] Subject: RE: [R] error() and C++ destructors And maybe I stressed Erik a bit, because he corrected himself some minutes later (when I was no longer looking over his shoulder). Again on behalf of Erik. - Lennart -Original Message- From: Källen, Erik Sent: 9 mars 2004 13:40 To: Borgman, Lennart Subject: RE: [R] error() and C++ destructors Whoops. This code leaks memory for the exception. It would be better to throw a pointer: void my_error(const string str) { throw new error_exception(str); } int my_method(int a, char *b) { try { return real_my_method(a, b); } catch (error_exception *pe) { static char error_msg[SOME_LARGE_NUMBER]; strncpy(error_msg, pe-msg.c_str(), sizeof(error_msg)); delete pe; error(error_msg); } } -Original Message- From: Borgman, Lennart Sent: 9 mars 2004 13:35 To: '[EMAIL PROTECTED]' Subject: RE: [R] error() and C++ destructors I am sending this reply on behalf of Erik (who is not a member of this list). - Lennart -Original Message- From: Källen, Erik Sent: 9 mars 2004 11:37 To: Borgman, Lennart Subject: RE: [R] error() and C++ destructors I would do something like: class error_exception { public: error_exception(const string str) : msg(str) {} string msg; }; void my_error(const string str) { throw error_exception(str); } int real_my_method(int a, char *b) { /* some code... */ return 0; } // this is the public method: int my_method(int a, char *b) { try { return real_my_method(a, b); } catch (error_exception e) { error(e.msg); } } You could probably even create a macro like: #define R_METHOD_IMPL(rettype, name, paramlist) \ rettype real_##name paramlist; \ rettype name paramlist { \ try { \ return real_##name paramlist; \ } \ catch (error_exception e) { \ error(e.msg); \ } \ } \ rettype real_##name paramlist You would use this macro like: R_METHOD_IMPL(int, my_method, (int a, char *b)) { // source code here } I think it would work, but I'm not sure (untested). /Erik Källén -Original Message- From: Vadim Ogranovich [mailto:[EMAIL PROTECTED] Sent: 2 mars 2004 22:00 To: R Help List Subject: [R] error() and C++ destructors Hi, I am writing C++ functions that are to be called via .Call() interface. I'd been using error() (from R.h) to return to R if there is an error, but then I realized that this might be not safe as supposedly error() doesn't throw an exception and therefore some destructors do not get called and some memory may leak. Here is a simple example extern C void foo() { string str = hello; error(message); } The memory allocated for str is leaked. Did anyone think about this and find a way to work around the problem? Thanks, Vadim [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the
Re: [R] R and tmp directroy
Probably you have TMPDIR set in your enviroment to point to /home/mart/tmp and that does not exist or is not writable. Solution: don't have variables pointing to inappropriate places? On Tue, 9 Mar 2004, Martin Olivier wrote: When I start R, it gives mkdir: Ne peut créer le répertoire `/home/mart/tmp/Rtmp11729'.: No such file or directory (I specify that my home path is /home/mart and the R version is 1.7.1) How I have to configure R to use the directory /tmp instead of /home/mart/tmp ? What is utility of this directory tmp for R? For temporary files, like all other Unix/Linux applications. See ?tempdir as well as internal uses (for HTML links, the editor temp file and so on). -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to use conditional statements to handle exceptions?
On Tue, 9 Mar 2004, Susan Lin wrote: I have a problem to handle the following statements. for(i in [1:3]) { file=paste(file, i, .dat) Don't you mean paste(file, i, .dat, sep=) ? Or are your files called `file 1 .dat'? bb - read.table(file) x11() plot(bb) dev.off() This opens a device, plots and closes it instantly. Is that what you want? I would have had par(ask=TRUE) outside the loop, which will automatically launch as graphics device if none is open. } When the input .dat file is empty, the program stops running and an error message appears. Could someone tell me how to handle this exception? ?try -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] read.table() question
Hi, In the following code, I got an error meesage if an input file is empty, and the program stopped running. Could someone to tell me how to handle this problem. I want the program to keep running. Thanks. for i in [1:3] { file=paste(file, i, .dat) x - read.data(file) x(11) plot(x); dev.off() } __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating its own family
I think you want linkfun - function(mu){mu/varcol} linkinv - function(eta){eta*varcol)} etc, that is a function of a single argument. Also, you can use lexical scope to capture varcol, as in the above: it will be in the environment of linkfun/inv. You did not set its environment as MASS does, and you do not need to. (MASS could have been written differently if it did not share code with S.) On Tue, 9 Mar 2004, Stephane DRAY wrote: Hello, I would like to create my own family for glm modelling If we consider a matrix Y, I would like to model Yij/var(Yj) with an inverse variance link. I have create my own family inspired by the negative.binomial of MASS: # myfamily=function (varcol) { env - new.env(parent = .GlobalEnv) assign(.varcol,varcol,envir=env) famname=myfamily link=inv col var linkfun=function(.varcol,mu){mu/(.varcol)} linkinv=function(.varcol,eta){eta*(.varcol)} variance - function (mu) rep.int(1, length(mu)) validmu - function (mu) TRUE dev.resids - function (y, mu, wt) wt * ((y - mu)^2) aic - function (y, n, mu, wt, dev) sum(wt) * (log(dev/sum(wt) * 2 * pi) + 1) + 2 mu.eta=function (eta) rep.int(1, length(eta)) initialize - expression({ n - rep.int(1, nobs) mustart - y }) environment(variance) - environment(validmu) - environment(dev.resids) - environment(aic) - env structure(list(family = famname, link = link, linkfun = linkfun, linkinv = linkinv, variance = variance, dev.resids = dev.resids, aic = aic, mu.eta = mu.eta, initialize = initialize, validmu = validmu), class = family) } # But it does not work when I try it Y=matrix(runif(50),10,5) glm(as.vector(t(Y))~x,family=myfamily(rep(apply(Y,2,var),10))) Error in family$linkfun(mustart) : Argument mu is missing, with no default Hope that someone could help me, Thanks in advances, Sincerely. Stéphane DRAY -- Département des Sciences Biologiques Université de Montréal, C.P. 6128, succursale centre-ville Montréal, Québec H3C 3J7, Canada Tel : 514 343 6111 poste 1233 E-mail : [EMAIL PROTECTED] -- Web http://www.steph280.freesurf.fr/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] how to use conditional statements to handle exceptions?
For R v1.8.0 you can use tryCatch() (it's great) to catch objects of class 'condition' and just print() them (instead of letting them generate errors) like this: for(i in 1:3) { file - paste(file, i, .dat, sep=) tryCatch({ bb - read.table(file) x11() plot(bb) dev.off() }, condition=function(ex) { print(ex); }) } As soon as/if an error is generated, tryCatch() will catch it an call the condition function, which will print it. Details: If the file does not exists when calling read.table() both a warning and an error is generated. Since warnings are now of class simpleWarning and (stop) errors are of class simpleError and both these are subclasses (via the abstract classes 'warning' and 'error', respectively) of class 'condition', which is the root class of all exception classes, it is best to catch by using 'condition' above. If one use 'error=...' instead, warnings will still be shown. Moreover, a shorter version of the above would be to use 'condition=print'. Some further comments: 1) Your code is not correct, e.g. [1:3]. Please submit example code that is executable! 2) Did you forget sep= in the paste line? 1) avoid using = to assign; or at least be consistent. Cheers Henrik Bengtsson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Susan Lin Sent: den 9 mars 2004 18:12 To: [EMAIL PROTECTED] Subject: [R] how to use conditional statements to handle exceptions? Hello, I have a problem to handle the following statements. for(i in [1:3]) { file=paste(file, i, .dat) bb - read.table(file) x11() plot(bb) dev.off() } When the input .dat file is empty, the program stops running and an error message appears. Could someone tell me how to handle this exception? Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailma n/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to continue develop package
Hi, I have completed a prototype of a package, say FOO, and now I want to start using it as an ordinary R package, i.e. attach it via library(FOO). On the other hand I will be adding functionality and fixing bugs so the code is going to change a lot. There is a couple of problems that don't know how to solve: 1. To be able to use library() the package must be INSTALLED. The installation creates a copy of the code. So it seems each time I change the code I need to repeat R CMD INSTALL. This is not too bad, but maybe there is a better way 2. (This is probably more of an ESS question) Suppose I have attached FOO via library(foo) which is now at the second position of the search list. Now if I use ESS to modify the definition of some function goo() from the package FOO and send the new definition to R it will NOT replace the old definition, rather creates a new function at the first position of the search list. The new function will of course overshadow the old one so I'll achieve the effect I want, but I'd feel better if I could replace the old definition rather than overshadow it. Does ESS allow this sort of things? These are my specific questions, however if you can suggest a different way of on-going development of a package I'd love to hear from you. Thanks, Vadim [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Adding data.frames together
I have a series of data frames that are identical structurally, i.e. - made with the same code, but I need to add them together so that they become one, longer, data frame, i.e. - each of the slot vectors are increased in length by the length of the added data frame vectors. So if I have df1 with a slot A so that length(df1$A) = 100 and I have df2 with a slot A so that length(df2$A)=200 then I need a method to create df3 its slot A is the df1$A plus df2$A such that length(df3$A) = 300. It does not appear that if you use data.frame to join two data frames it just adds the slots of both sources to the destination data frame and that is not what I want. In my finally solution, I need to do this with multiple data.frames that slot-wise are identical, but each slot length is different between data frames. Seems like there should be an easy solution, but I just have not stumbled across it in the documentation. Thanks, John C. Sweval Database Architect Illumigen Biosciences, Inc. Email: [EMAIL PROTECTED] Phone: 206-378-0400 Fax: 206-378-0408 [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] years from as.POSIXlt
Prof Brian Ripley wrote: See ?julian, which says Note: Other components such as the day of the month or the year are very easy to computes: just use 'as.POSIXlt' and extract the relevant component. Hello, unfortunately not all mentioned functions work on all machines. Where months(.leap.seconds) works on all systems, a call to julian(leap.seconds) workes perfectly only on Linux (R 1.8.0) but failed on two different XP Machines (German XP version): Error in fromchar(x) : character string is not in a standard unambiguous format I've tested several things, several versions of msvcrt.dll, different PATH settings, locale set to German or USA, R 1.8.1 and R 1.7.1, but the problem remains. On the other hand as.numeric(format(x, f=%d)) works perfectly, so I do not understand what is wrong with julian() Thomas P. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Slow reshape from 5x600000 to 6311 x 132
Thanks for the info - it inspired me to keep tweaking. R --min-vsize=400M --min-nsize=6M allowed me to run in a few minutes - I had been trying larger values of --min-vsize (600M) (I have 1 Gig of RAM, but a lot of stuff running), but that was evidentally causing R to swap during the reshape, which caused it to really slow down. --Chris Christian Schulz wrote on 3/5/04, 2:28 AM: Hi, my reshape's from ~1.4 million obs. to ~150.00 obs. 50 attr. goes surprinsing fast (1-2 miniutes), but is less complex then yours. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] how to continue develop package
My suggestion is to treat the installed package as `binary', even if the code is purely in R. This way you will only make modifications to the _source_ and make up the `binary' as needed. It's really not burdensome. Your second question has nothing to do with ESS. When you modify objects on the search list, the modified copy is placed in the global environment (pos=1). After you experimented with the modification and are happy with it, just place it in the package and re-install. It doesn't make sense to edit code in the installed package directly: That will be the only copy of the changed package, and you won't be able to package that up for installation by others, at least not easily. HTH, Andy From: Vadim Ogranovich Hi, I have completed a prototype of a package, say FOO, and now I want to start using it as an ordinary R package, i.e. attach it via library(FOO). On the other hand I will be adding functionality and fixing bugs so the code is going to change a lot. There is a couple of problems that don't know how to solve: 1. To be able to use library() the package must be INSTALLED. The installation creates a copy of the code. So it seems each time I change the code I need to repeat R CMD INSTALL. This is not too bad, but maybe there is a better way 2. (This is probably more of an ESS question) Suppose I have attached FOO via library(foo) which is now at the second position of the search list. Now if I use ESS to modify the definition of some function goo() from the package FOO and send the new definition to R it will NOT replace the old definition, rather creates a new function at the first position of the search list. The new function will of course overshadow the old one so I'll achieve the effect I want, but I'd feel better if I could replace the old definition rather than overshadow it. Does ESS allow this sort of things? These are my specific questions, however if you can suggest a different way of on-going development of a package I'd love to hear from you. Thanks, Vadim [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Notice: This e-mail message, together with any attachments,...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] years from as.POSIXlt
as.numeric(format(x, f=%j)) which is the right code, works perfectly, too. Thomas P. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Adding data.frames together
Use rbind() (for row-bind). Here are some examples: d1 - data.frame(x=1, y=1) d2 - data.frame(x=1:2, y=1:2) d3 - data.frame(x=3, y=3) rbind(d1,d2,d3) x y 1 1 1 11 1 1 2 2 2 12 3 3 do.call(rbind, list(d1,d2,d3)) x y 1 1 1 11 1 1 2 2 2 12 3 3 [or even this:] do.call(rbind, eval(parse(text=paste(paste(list(, paste(d,1:3,sep=,collapse=,), )) x y 1 1 1 11 1 1 2 2 2 12 3 3 HTH, Andy From: John Sweval I have a series of data frames that are identical structurally, i.e. - made with the same code, but I need to add them together so that they become one, longer, data frame, i.e. - each of the slot vectors are increased in length by the length of the added data frame vectors. So if I have df1 with a slot A so that length(df1$A) = 100 and I have df2 with a slot A so that length(df2$A)=200 then I need a method to create df3 its slot A is the df1$A plus df2$A such that length(df3$A) = 300. It does not appear that if you use data.frame to join two data frames it just adds the slots of both sources to the destination data frame and that is not what I want. In my finally solution, I need to do this with multiple data.frames that slot-wise are identical, but each slot length is different between data frames. Seems like there should be an easy solution, but I just have not stumbled across it in the documentation. Thanks, John C. Sweval Database Architect Illumigen Biosciences, Inc. Email: [EMAIL PROTECTED] Phone: 206-378-0400 Fax: 206-378-0408 [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Notice: This e-mail message, together with any attachments,...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] corARMA and ACF in nlme
Hi R-sters, Just wondering what I might be doing wrong. I'm trying to fit a multiple linear regression model, and being ever mindful about the possibilities of autocorrelation in the errors (it's a time series), the errors appear to follow an AR1 process (ar(ts(glsfit$residuals)) selected order 1). So, when I go back and try to do the simultaneous regression and error fit with gls, the acf and pacf plots of residuals from the old model (glsfit) and those plots of the new model (glsAR1fit, below) look exactly the same (a significant autocorrelation at lag of 1). Any ideas out there as to what I may be doing wrong? Is there an error in my code? Here's my R code for the simultaneous model fit (taking a phi estimate=0.6 from a previous step ACF(glsfit)): glsAR1fit-gls(y~x1+x2+x3+x4, na.action = na.omit, subset=12:54, correlation = corARMA(0.6, p=1, q=0, fixed = FALSE)) Thanks much, Jeff ~~ Jeff Jorgensen Center for Limnology University of Wisconsin Madison ph (608) 263-2304 680 North Park Street fx (608) 265-2340 Madison, Wisconsin 53706http://limnology.wisc.edu ~~~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Adding data.frames together
John - The function rbind() operates on pairs of data frames, and (somewhat arcane and definitely NOT for beginning users) do.call(rbind, list(df1, df2, df3, df4, df5))) will combine any number (in this case 5) of data frames. As of February 2003, the do.call() approach did not deal gracefully with columns in a data frame which had been converted to factors (happens by default in read.table()). In my own code I had to go through some gyrations to protect against that. For futher information on the do.call() approach, search the r-help archives for do.call AND rbind. In particular, there was a thread involving jerosenb and rpeng titled [R] quotes within quotes with one email dated Wed, 9 Apr 2003. - tom blackwell - u michigan medical school - ann arbor - On Tue, 9 Mar 2004, John Sweval wrote: I have a series of data frames that are identical structurally, i.e. - made with the same code, but I need to add them together so that they become one, longer, data frame, i.e. - each of the slot vectors are increased in length by the length of the added data frame vectors. So if I have df1 with a slot A so that length(df1$A) = 100 and I have df2 with a slot A so that length(df2$A)=200 then I need a method to create df3 its slot A is the df1$A plus df2$A such that length(df3$A) = 300. It does not appear that if you use data.frame to join two data frames it just adds the slots of both sources to the destination data frame and that is not what I want. In my finally solution, I need to do this with multiple data.frames that slot-wise are identical, but each slot length is different between data frames. Seems like there should be an easy solution, but I just have not stumbled across it in the documentation. Thanks, John C. Sweval Database Architect Illumigen Biosciences, Inc. Email: [EMAIL PROTECTED] Phone: 206-378-0400 Fax: 206-378-0408 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Adding data.frames together - correction
Correction to my reply below: If my memory serves correctly, one year and many projects later, I wanted to keep character data as character, not factors, throughout. The gyrations were to maintain this despite using rbind(), not because rbind() behaved badly with factors. Please excuse my foggy memory. - tom blackwell - u michigan medical school - ann arbor - On Tue, 9 Mar 2004, Tom Blackwell wrote: John - The function rbind() operates on pairs of data frames, and (somewhat arcane and definitely NOT for beginning users) do.call(rbind, list(df1, df2, df3, df4, df5))) will combine any number (in this case 5) of data frames. As of February 2003, the do.call() approach did not deal gracefully with columns in a data frame which had been converted to factors (happens by default in read.table()). In my own code I had to go through some gyrations to protect against that. For futher information on the do.call() approach, search the r-help archives for do.call AND rbind. In particular, there was a thread involving jerosenb and rpeng titled [R] quotes within quotes with one email dated Wed, 9 Apr 2003. - tom blackwell - u michigan medical school - ann arbor - On Tue, 9 Mar 2004, John Sweval wrote: I have a series of data frames that are identical structurally, i.e. - made with the same code, but I need to add them together so that they become one, longer, data frame, i.e. - each of the slot vectors are increased in length by the length of the added data frame vectors. So if I have df1 with a slot A so that length(df1$A) = 100 and I have df2 with a slot A so that length(df2$A)=200 then I need a method to create df3 its slot A is the df1$A plus df2$A such that length(df3$A) = 300. It does not appear that if you use data.frame to join two data frames it just adds the slots of both sources to the destination data frame and that is not what I want. In my finally solution, I need to do this with multiple data.frames that slot-wise are identical, but each slot length is different between data frames. Seems like there should be an easy solution, but I just have not stumbled across it in the documentation. Thanks, John C. Sweval Database Architect Illumigen Biosciences, Inc. Email: [EMAIL PROTECTED] Phone: 206-378-0400 Fax: 206-378-0408 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Adding data.frames together
Actually, rbind() operates on any number of arguments, as stated in the documentation ?rbind. (If it only operated on pairs of arguments, the do.call() approach wouldn't get around that anyway. The do.call() approach can be very useful when one has a list of data frames to be rbind'ed together, but it's not necessary when the data frames are in separate objects.) Also, rbind() seems to cope with factor columns now - at least in the simple example below. Are there other examples where it does not cope? Here are some examples: df1 - data.frame(a=1:3,b=101:103) df2 - data.frame(a=4:5,b=104:105) df3 - data.frame(a=6,b=106) rbind(df1, df2, df3) a b 1 1 101 2 2 102 3 3 103 11 4 104 21 5 105 12 6 106 df1 - data.frame(a=1:3,b=letters[1:3]) df2 - data.frame(a=4:5,b=letters[4:5]) df - rbind(df1, df2) sapply(df, class) a b integer factor df a b 1 1 a 2 2 b 3 3 c 11 4 d 21 5 e -- Tony Plate At Tuesday 05:00 PM 3/9/2004, Tom Blackwell wrote: John - The function rbind() operates on pairs of data frames, and (somewhat arcane and definitely NOT for beginning users) do.call(rbind, list(df1, df2, df3, df4, df5))) will combine any number (in this case 5) of data frames. As of February 2003, the do.call() approach did not deal gracefully with columns in a data frame which had been converted to factors (happens by default in read.table()). In my own code I had to go through some gyrations to protect against that. For futher information on the do.call() approach, search the r-help archives for do.call AND rbind. In particular, there was a thread involving jerosenb and rpeng titled [R] quotes within quotes with one email dated Wed, 9 Apr 2003. - tom blackwell - u michigan medical school - ann arbor - On Tue, 9 Mar 2004, John Sweval wrote: I have a series of data frames that are identical structurally, i.e. - made with the same code, but I need to add them together so that they become one, longer, data frame, i.e. - each of the slot vectors are increased in length by the length of the added data frame vectors. So if I have df1 with a slot A so that length(df1$A) = 100 and I have df2 with a slot A so that length(df2$A)=200 then I need a method to create df3 its slot A is the df1$A plus df2$A such that length(df3$A) = 300. It does not appear that if you use data.frame to join two data frames it just adds the slots of both sources to the destination data frame and that is not what I want. In my finally solution, I need to do this with multiple data.frames that slot-wise are identical, but each slot length is different between data frames. Seems like there should be an easy solution, but I just have not stumbled across it in the documentation. Thanks, John C. Sweval Database Architect Illumigen Biosciences, Inc. Email: [EMAIL PROTECTED] Phone: 206-378-0400 Fax: 206-378-0408 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] accuracy of chi-square distribution approximations
Hi there, How accurate is the aproximation R makes to the Chi-Square distribution? For example, if I run: qchisq(1/100,6) [1] 0.03650857 how accurate is 0.0365 compared to the theoretical percentile? What kind of approximations have been made in the software's algorithm? It woudl be useful to know since I am working with tiny percentiles such as one one-millionth and one one-billionth, and I am not sure how R comes up with the percentile numbers. Thanks for any help, -Victoria __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to use MLE-class?
Hi there, I had successfully use MLE function to solve my problem. Is there anyone knows how to get related information? i.e., value of likelihood function, information matrix, and etc. I know MLE-class can do it but I can not find any information tells me how to do it. Thanks a billions, Yihsu [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re: R-help Digest, Vol 13, Issue 9
Cédric Finet wrote: I thank you for your answer but I do not understand yet why the Fisher´s exact test does not work. And why is a negative key. Cédric Finet Running the original TOMS643 fortran code (R uses an f2c translation of this) says: FEXACT ERROR: 30 Stack length exceeded in f3xact. This problem should not occur. The integer hash key is bigger than the largest allowable integer, and so appears as a negative number. Table is too big. | David Duffy (MBBS PhD) ,-_|\ | email: [EMAIL PROTECTED] ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] How to use MLE-class?
Do you mean mle() in the package `mle'? If so, see ?mle-class for a description. Andy From: YIHSU CHEN Hi there, I had successfully use MLE function to solve my problem. Is there anyone knows how to get related information? i.e., value of likelihood function, information matrix, and etc. I know MLE-class can do it but I can not find any information tells me how to do it. Thanks a billions, Yihsu [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Notice: This e-mail message, together with any attachments,...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Adding data.frames together
On 9 Mar 2004 at 14:41, John Sweval wrote: If you have the dataframes as components of a list dfs, maybe you can do something like do.call(cbind, dfs) Kjetil Halvorsen I have a series of data frames that are identical structurally, i.e. - made with the same code, but I need to add them together so that they become one, longer, data frame, i.e. - each of the slot vectors are increased in length by the length of the added data frame vectors. So if I have df1 with a slot A so that length(df1$A) = 100 and I have df2 with a slot A so that length(df2$A)=200 then I need a method to create df3 its slot A is the df1$A plus df2$A such that length(df3$A) = 300. It does not appear that if you use data.frame to join two data frames it just adds the slots of both sources to the destination data frame and that is not what I want. In my finally solution, I need to do this with multiple data.frames that slot-wise are identical, but each slot length is different between data frames. Seems like there should be an easy solution, but I just have not stumbled across it in the documentation. Thanks, John C. Sweval Database Architect Illumigen Biosciences, Inc. Email: [EMAIL PROTECTED] Phone: 206-378-0400 Fax: 206-378-0408 [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to use MLE-class?
Have you read Pinheiro and Bates (2000) Mixed-Effects Models in S and S-Plus (Springer)? I learned much from that book. Also, help.search(lme) gave interesting results. hope this helps. spencer graves YIHSU CHEN wrote: Hi there, I had successfully use MLE function to solve my problem. Is there anyone knows how to get related information? i.e., value of likelihood function, information matrix, and etc. I know MLE-class can do it but I can not find any information tells me how to do it. Thanks a billions, Yihsu [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] AutoResponse - Email Returned SAXK (KMM44933619V84198L0KM)
Thank you for contacting PayPal Customer Service. In an effort to assist you as quickly and efficiently as possible, please direct all customer service inquires through our website. Click on the hyperlink below to go to the PayPal website. After entering your email address and password into the Member Log In box, you can submit your inquiry via our Customer Service Contact form. If you indicate the type of question you have with as much detail as you can, we will be able to provide you with the best customer service possible. If your email program is unable to open hyperlinks, please copy and paste this URL into the address bar of your browser. https://www.paypal.com/wf/f=default If you are contacting PayPal because you are unable to log into your account, please use the contact form below. https://www.paypal.com/ewf/f=default Thank you for choosing PayPal! Note: When you click on links in this email, you will be asked to log into your PayPal Account. As always, make sure that you are logging into a secure PayPal page by looking for 'https://www.paypal.com/' at the beginning of the URL. Please do not reply to this e-mail. Mail sent to this address will not be answered. Original Email: Please read the attached file. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Rcmd BATCH command line arguments
I want to run Rcmd BATCH with R_DEFAULT_PACKAGE=base so it doesn't load any packages, but it seems to reject this argument because it does not start with a '-' or '--'. Is there a different argument that will work? Thanks. Benjamin Stabler Transportation Planning Analysis Unit Oregon Department of Transportation 555 13th Street NE, Suite 2 Salem, OR 97301 Ph: 503-986-4104 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] years from as.POSIXlt
If you search the mail archives for fromchar there are a number of discussions of similar bugs that all seem to come from German or other European users, suggesting locale problems. I suspect it won't be easy for others to reproduce this so you might try to see what you can track down yourself. fromchar is in as.POSIXlt so perhaps you could try to get the bug to appear by using as.POSIXlt directly and then debugging it using debug(as.POSIXlt) and as soon as it defines fromchar debug(fromchar) In terms of an interim solution, you could use chron. For example, for the .leap.seconds problem: require(chron) .leap.seconds.chron - chron( format(.leap.seconds,%m/%d/%Y), format(.leap.seconds,%H:%M:%S) ) as.numeric(.leap.seconds.chron) where the last line uses the fact that chron stores its dates internally as the number of days since January 1, 1970. --- Date: Wed, 10 Mar 2004 00:04:30 +0100 From: Thomas Petzoldt [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [R] years from as.POSIXlt Prof Brian Ripley wrote: See ?julian, which says Note: Other components such as the day of the month or the year are very easy to computes: just use 'as.POSIXlt' and extract the relevant component. Hello, unfortunately not all mentioned functions work on all machines. Where months(.leap.seconds) works on all systems, a call to julian(leap.seconds) workes perfectly only on Linux (R 1.8.0) but failed on two different XP Machines (German XP version): Error in fromchar(x) : character string is not in a standard unambiguous format I've tested several things, several versions of msvcrt.dll, different PATH settings, locale set to German or USA, R 1.8.1 and R 1.7.1, but the problem remains. On the other hand as.numeric(format(x, f=%d)) works perfectly, so I do not understand what is wrong with julian() Thomas P. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] years from as.POSIXlt
On Wed, 10 Mar 2004, Thomas Petzoldt wrote: as.numeric(format(x, f=%j)) which is the right code, works perfectly, too. but the recommended procedure is on the help page ?julian, and of course works perfectly. Just use 1+x$yday if you want 1-based day of the year. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] help
Hello, I am a new member, and I need your help. For my work (thesis), I use the package rpart to construct trees. But, to continu my studies, I need to calcule the 'variable importance'. But, I don't find a program to do this in the implementation of R. Is there someone who know if there exist a program which calculate the 'variable importance', notion defined by Breiman and al. in CART ? If this program exists, could you tell me where I can find it, to use it? Thanks a lot, and sorry for my english. Christine Tuleau __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] years from as.POSIXlt
On Wed, 10 Mar 2004, Thomas Petzoldt wrote: (without copying me) Prof Brian Ripley wrote: See ?julian, which says Note: Other components such as the day of the month or the year are very easy to computes: just use 'as.POSIXlt' and extract the relevant component. Hello, unfortunately not all mentioned functions work on all machines. Where No function is mentioned in that note! months(.leap.seconds) works on all systems, a call to julian(leap.seconds) What is `leap.seconds'? julian(.leap.seconds) works on Windows XP, of course. workes perfectly only on Linux (R 1.8.0) but failed on two different XP Machines (German XP version): Error in fromchar(x) : character string is not in a standard unambiguous format What is `leap.seconds' on your machine? It is an object that as.POSIXct is failing on, I suspect (try traceback() to be sure). I've tested several things, several versions of msvcrt.dll, different PATH settings, locale set to German or USA, R 1.8.1 and R 1.7.1, but the problem remains. On the other hand as.numeric(format(x, f=%d)) works perfectly, so I do not understand what is wrong with julian() Do *read* the advice on how to get yday quoted above. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html