Re: [R] Building package on Windows: No rule to make target '-llapack'
On Wed, 9 Jun 2004, Zhu Wang wrote: I have a problem to build a package on Windows XP while there is no problem on Linux. The Makefile is something like: There would be a problem on Linux, if that Makefile were used. I suspect it is not used. ### LIBNAME=cts PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) (You should not need $(FLIBS) here.) OBJS=file1.o ... file20.o -llapack -lblas The last two are not objects, and -llapack refers to something like liblapack.a. I don't see how this can work anywhere. On the other hand, you have lapack and blas selected in PKG_LIBS, but you are not using that macro. $(LIBNAME)$(SHLIB_EXT): $(OBJS) $(SHLIB_LD) $(SHLIB_LDFLAGS) -o $@ $(OBJS) $(FLIBS) clean: @rm -f *.o *.$(SHLIB_EXT) realclean: clean # To build the package on Windows XP, I have followed the instructions to install tools/software required and it seems the 'make' worked fine, except for the error message: make[3]: No rule to make target 'llapack', needed by 'cts.a'. stop. Now I think maybe two problems: one is that maybe I do not have Lapack and Blas installed on Windows XP and second is that I do not set up a correct file, something like 'configure'. Maybe there are more problems. I have read some files in \src\gnuwin32, but I did not find what I needed. What are you actually trying to do? It is not normal for a package to have a Makefile in its src directory, which is what I guess (but only guess) you have presented. All that is normally needed is a Makevars file. Take a look at e.g. that in mclust. Is this your package or someone else's (in which case why are you not asking the author)? Either you or that author needs to read `Writing R Extensions' and look at some of the many examples in CRAN packages. -- 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] Re: R equivalent of Splus rowVars function
Rmetrics availalble from www.rmetrics.org has implemented several R functions which deal with column statistics, row statistics and rolling analysis. Diethelm Wuertz David Brahm wrote: Mark Leeds [EMAIL PROTECTED] wrote (to S-News): does anyone know the R equivalent of the SPlus rowVars function ? Andy Liaw [EMAIL PROTECTED] replied: More seriously, I seem to recall David Brahms at one time had created an R package with these dimensional summary statistics, using C code. (And I pointed him to the `two-pass' algorithm for variance.) Here are the functions that didn't make it into R's base package, which should be very similar to the S-Plus functions of the same names. The twopass argument determines whether Andy's two-pass algorithm (Chan Golub LeVegue) is used (it's slower but more accurate). In real life I set the twopass default to FALSE, because in finance noise is always bigger than signal. I am cc'ing to R-help, as this is really an R question. [[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] Failure to compile on Itanium
I am trying to compile R on an Itanium machine running Red Hat 7.2 and gcc version 2.96. The build fails with the following symptoms: g77 -fPIC -g -O2 -c cmplx.f -o cmplx.lo g77 -fPIC -g -O2 -c cmplxblas.f -o cmplxblas.lo gcc -shared -L/usr/local/lib -o libRlapack.so dlapack0.lo dlapack1.lo dlapack2.lo dlapack3.lo cmplx.lo cmplxblas.lo -L/usr/local/lib -L/usr/lib/gcc-lib/ia64-redhat-linux/2.96 -L/usr/lib/gcc-lib/ia64-redhat-linux/2.96/../../.. -lg2c -lm /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen collect2: ld returned 1 exit status make[4]: *** [libRlapack.so] Error 1 make[4]: Leaving directory `/home/etptupaf/R-1.9.0/src/modules/lapack' make[3]: *** [R] Error 2 make[3]: Leaving directory `/home/etptupaf/R-1.9.0/src/modules/lapack' make[2]: *** [R] Error 1 make[2]: Leaving directory `/home/etptupaf/R-1.9.0/src/modules' make[1]: *** [R] Error 1 make[1]: Leaving directory `/home/etptupaf/R-1.9.0/src' make: *** [R] Error 1 I searched and found in _http://tolstoy.newcastle.edu.au/R/devel/04a/0679.html_ an answer from BD Ripley to a query with exactly the same problem, suggesting that a newer version of gcc be used. This solution is out of reach for me, as the system managers are not willing to undertake any changes. They suggest instead that I use the recommended compilers, ecc and ecf. I have tried to do so with no success so far: the configure script fails to find convenient values for the different flags to be set. I have set some manually (in config.site), to no avail so far. Has anyone compiled R with ecc and ecf? Or with gcc-2.96? I would be grateful if he/she could share his/her config.site settings. Best, ft. -- Fernando TUSELLe-mail: Departamento de Econometría y Estadística [EMAIL PROTECTED] Facultad de CC.EE. y Empresariales Tel: (+34)94.601.3733 Avenida Lendakari Aguirre, 83 Fax: (+34)94.601.3754 E-48015 BILBAO (Spain)Secr: (+34)94.601.3740 __ [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] question about hierclust {multiv}
my major is bioinformatics, and i'm trying to cluster ( agglomerate the closest pari of observations ) in R. i have already got my own similarities metric, but do not know how to clust it based on similarities instead of dissimilarities. since the help document of hierclust mentions the parameter sim, which seems good to me, but it doesn't appear in the code of hierclust() function again? and no sample about it. so could anybody please help me as author? thanks in advance xinan yang [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] Help with a Lattice plot that fails with an empty unique combination
Deepayan == Deepayan Sarkar [EMAIL PROTECTED] on Wed, 9 Jun 2004 18:04:38 -0500 writes: Deepayan On Wednesday 09 June 2004 01:58, Tom Mulholland wrote: While using Lattice I received the following error. Error in if (xx != 0) xx/10 else z/10 : argument is of length zero In addition: Warning messages: 1: is.na() applied to non-(list or vector) in: is.na(x) 2: is.na() applied to non-(list or vector) in: is.na(x) 3: no finite arguments to min; returning Inf 4: no finite arguments to max; returning -Inf 5: NaNs produced in: log(x, base) Can anyone point me in the right direction. Deepayan A traceback() shows that this is happening due to Deepayan jitter() being called with a length-0 numeric. clearly a bug in jitter() -- which has been fixed 2 minutes ago for R 1.9.1 alpha {and R-devel}: Now jitter(x) has if(length(x) == 0) return(x). Deepayan I have added a check in panel.stripplot. Until the Deepayan next release, you can work around it by: Martin Maechler __ [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] Failure to compile on Itanium
On Thu, 10 Jun 2004, F. Tusell wrote: I am trying to compile R on an Itanium machine running Red Hat 7.2 and gcc version 2.96. The build fails with the following symptoms: g77 -fPIC -g -O2 -c cmplx.f -o cmplx.lo g77 -fPIC -g -O2 -c cmplxblas.f -o cmplxblas.lo gcc -shared -L/usr/local/lib -o libRlapack.so dlapack0.lo dlapack1.lo dlapack2.lo dlapack3.lo cmplx.lo cmplxblas.lo -L/usr/local/lib -L/usr/lib/gcc-lib/ia64-redhat-linux/2.96 -L/usr/lib/gcc-lib/ia64-redhat-linux/2.96/../../.. -lg2c -lm /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen collect2: ld returned 1 exit status make[4]: *** [libRlapack.so] Error 1 make[4]: Leaving directory `/home/etptupaf/R-1.9.0/src/modules/lapack' make[3]: *** [R] Error 2 make[3]: Leaving directory `/home/etptupaf/R-1.9.0/src/modules/lapack' make[2]: *** [R] Error 1 make[2]: Leaving directory `/home/etptupaf/R-1.9.0/src/modules' make[1]: *** [R] Error 1 make[1]: Leaving directory `/home/etptupaf/R-1.9.0/src' make: *** [R] Error 1 I searched and found in _http://tolstoy.newcastle.edu.au/R/devel/04a/0679.html_ an answer from BD Ripley to a query with exactly the same problem, That's not who that page says the author was. suggesting that a newer version of gcc be used. It's essential to allow compiled Fortran code to be included in a dynamic library on your platform, as was explained on that page. This solution is out of reach for me, as the system managers are not willing to undertake any changes. What is the problem with your compiling gcc-3.4.0 and using that? It is no more complex that compiling R. They suggest instead that I use the recommended compilers, ecc and ecf. I have tried to do so with no success so far: the configure script fails to find convenient values for the different flags to be set. I have set some manually (in config.site), to no avail so far. Has anyone compiled R with ecc and ecf? Or with gcc-2.96? I would be grateful if he/she could share his/her config.site settings. Best, ft. The alternative is to try to compile a version of R which is as out of date as your OS and gcc compiler. -- 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] Getting Pr from Summary(lm)
David == David J Netherway [EMAIL PROTECTED] on Thu, 10 Jun 2004 11:19:05 +0930 writes: David Thanks for all the relies. David I recently discovered names and applied it to lm David objects but did not think to apply it to the David summary object. ok, and now you should probably discover 'str()' as well. Martin __ [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] question about hierclust {multiv}
Hi! I would convert the simmilarities into dissimilarities by myself. Its quite easy. For example to make a dissimilarity from correlation which is a simmilarity measures you can: dcorr = 1 - cor and dcorr will be a dissimilarity. More general. Make the smallest value the largest and the largest the smallest. And ensure that the transformation is monotonical. Sincerely Eryk *** REPLY SEPARATOR *** On 6/10/2004 at 9:06 AM Xinan Yang wrote: my major is bioinformatics, and i'm trying to cluster ( agglomerate the closest pari of observations ) in R. i have already got my own similarities metric, but do not know how to clust it based on similarities instead of dissimilarities. since the help document of hierclust mentions the parameter sim, which seems good to me, but it doesn't appear in the code of hierclust() function again? and no sample about it. so could anybody please help me as author? thanks in advance xinan yang [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 Dipl. bio-chem. Eryk Witold Wolski@MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin 'v' tel: 0049-30-83875219 / \ mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski __ [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] nls and R scoping rules
I apologize for posting this in essence the second time (no light at the end of the tunnel yet..): is there a way to enforce that nls takes both, the data *and* the model definition from the parent environment? the following fragment shows the problem. # cut here== wrapper - function (choose=0) { x - seq(0,2*pi,len=100) y - sin(1.5*x); y - rnorm(y,y,.1*max(y)) if (choose==0) { rm(fifu,pos=1) fifu - function(w,x) {sin(w*x)} } else assign('fifu',function(w,x) {sin(w*x)},.GlobalEnv) res - nls(y ~ fifu(w,x),start=list(w=1)) res } # cut here== if called as wrapper(1) this runs fine because the fitting function fifu is assigned in the GlobalEnv. if called as wrapper(0), fifu is defined only locally and nls (actually, nlsModel, I think) does not know what I'm talking about. I understand, the problem is that the scoping rules are such that nls does not resolve 'fifu' in the parent environment, but rather in the GlobalEnv. (this is different for the data, which *are* taken from the parent environment of the nls-call). I tried some variants of using eval but without starting to modify nls itself there seems no way (up to now, anyway). The solution to assign 'fifu' directly into the GlobalEnv does work, of course, but leads to the undesirable effect of accumulating objects in the workspace which are not needed there (and might overwrite existing ones). in response to my first post, I got the hint that for lm the situation is different: it handles the above situation as desired (i.e. accepts local model definition). in so far one might even argue that this behaviour of lm and nls leads to an inconsistent behaviour of R in quite similar situations (e.g. replacing at some point a linar model by a nonlinear model in some large project is not achieved by simply replacing lm by nls somewhere deep down in the source code). regards, joerg __ [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] question about hierclust {multiv}
As I've already said on the R-devel list, MM why on earth are you using hierclust() from the ORPHANED package MM 'multiv', when there's hclust() in the core 'stats' package MM and 'agnes' in the recommended 'cluster' package ? {and your question is not about hierclust but about dissimilarities and has already been answered}. Regards, Martin Maechler __ [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] nls and R scoping rules
On Thu, 10 Jun 2004, joerg van den hoff wrote: I apologize for posting this in essence the second time (no light at the end of the tunnel yet..): is there a way to enforce that nls takes both, the data *and* the model definition from the parent environment? the following fragment shows the problem. # cut here== wrapper - function (choose=0) { x - seq(0,2*pi,len=100) y - sin(1.5*x); y - rnorm(y,y,.1*max(y)) if (choose==0) { rm(fifu,pos=1) fifu - function(w,x) {sin(w*x)} } else assign('fifu',function(w,x) {sin(w*x)},.GlobalEnv) res - nls(y ~ fifu(w,x),start=list(w=1)) res } # cut here== if called as wrapper(1) this runs fine because the fitting function fifu is assigned in the GlobalEnv. if called as wrapper(0), fifu is defined only locally and nls (actually, nlsModel, I think) does not know what I'm talking about. I understand, the problem is that the scoping rules are such that nls does not resolve 'fifu' in the parent environment, but rather in the GlobalEnv. (this is different for the data, which *are* taken from the parent environment of the nls-call). I assume by `data' you mean not the `data' argument to nls but the variables referred to in your formula. I tried some variants of using eval but without starting to modify nls itself there seems no way (up to now, anyway). The solution to assign 'fifu' directly into the GlobalEnv does work, of course, but leads to the undesirable effect of accumulating objects in the workspace which are not needed there (and might overwrite existing ones). S has frame 1 for this purpose. The nearest equivalent I know in R is to attach an environment in position 2 and assign objects like 'fifu' there, which avoids your `undesirable effect'. in response to my first post, I got the hint that for lm the situation is different: it handles the above situation as desired (i.e. accepts local model definition). in so far one might even argue that this behaviour of lm and nls leads to an inconsistent behaviour of R in quite similar situations (e.g. replacing at some point a linar model by a nonlinear model in some large project is not achieved by simply replacing lm by nls somewhere deep down in the source code). I think that is simply wrong. It is a _function_ in your non-linear model definition that is not being found, not the variables (which you call `data' above). You do currently need to ensure that the functions in your formulae are in scope when called from nlsModel. Around R 1.2.x the notion was introduced that variables should be looked for in the environment of a formula. Functions using model.frame got converted to do that, but nls did not. I guess that the best way forward is to ensure that nls (and nlsModel) does search the environment of the formula for functions. -- 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 initialize random seed properly ?
I want to start R processes on multiple processors from single shell script and I want all of them to have different random seeds. The usual way would be using the process ID for the initialization. Or the shell script could just hand out consecutive numbers 1, 2, 3, ... Lutz __ [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] Manova and specifying the model
Hi, I would like to conduct a MANOVA. I know that there 's the manova() funciton and the summary.manova() function to get the appropriate summary of test statistics. I just don't manage to specify my model in the manova() call. How to specify a model with multiple responses and one explanatory factor? If I type: pcor.manova-manova(isol+hcom+habarea+inclin+windprot+shrubcov+herbh+baregr+flowcov~pcor, data=pcor.df) I always get error messages like: Error in manova(isol + hcom + habarea + inclin + windprot + shrubcov + : need multiple response Can someone help me? Thanks Steffi Stefanie von Felten Käppelistrasse 24 4600 Olten Tel: 062/296 13 14 e-mail: [EMAIL PROTECTED] [[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] nls and R scoping rules
On Thu, 10 Jun 2004, Prof Brian Ripley wrote: Around R 1.2.x the notion was introduced that variables should be looked for in the environment of a formula. Functions using model.frame got converted to do that, but nls did not. I guess that the best way forward is to ensure that nls (and nlsModel) does search the environment of the formula for functions. It transpires that is rather easy to achieve. At the top of nlsModel and nlsModel.plinear use env - new.env(parent=environment(form)) instead of env - new.env() This then automatically searches for objects used in the formula Notes 1) nls is in a namespace, so you need to fix the copy in the namespace or fix the source code and rebuild. 2) This will add to the baggage needed when you save() a nls fit in a workspace. I think that is inevitable as we cannot just identify the funtions used in the formula (as they might call other functions in the local environment), and it is necessary to capture the objects needed to evaluate the formula for the predict() method to be reliable. We could call all.names() to get the names of functions used directly in the formula, but that seems not good enough (previous para). Question to the cognescenti: is the price in 2) too great for this to be done for 1.9.1? I will put the change in R-devel for now. -- 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] Table to Data Frame
[Forwarding on behalf of a colleague] She's got a list with several tables: tab - list() for(i in 1:6) { + tab[[i]] - table(freq[i]) + } tab [[1]] 0 0.17 0.3 0.51 2.534 1962515252 [[2]] 0 0.17 0.31 2.534 199136261 [[3]] 0 0.5 217 1 [[4]] 0 2.5 216 2 [[5]] 0 0.17 0.3 0.51 2.534 2071111241 [[6]] 0 0.173 21611 And would like to convert to a data frame, like: 0 0.17 0.3 0.5 1 1962 5 1 5 1991 3 0 6 2170 0 1 0 [snip] Basically down the columns she'd like to have the counts. But because each table in the list has got different number of columns, I've been unable to convert them into a data frame for her. Any help would be greatly appreciated! Cheers, Kevin __ [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] Manova and specifying the model
Hallo On 23 May 2004 at 13:44, Stefanie von Felten wrote: Hi, I would like to conduct a MANOVA. I know that there 's the manova() funciton and the summary.manova() function to get the appropriate summary of test statistics. I just don't manage to specify my model in the manova() call. How to specify a model with multiple responses and one explanatory factor? If I type: pcor.manova-manova(isol+hcom+habarea+inclin+windprot+shrubcov+herbh+b aregr+flowcov~pcor, data=pcor.df) I always get error messages like: Error in manova(isol + hcom + habarea + inclin + windprot + shrubcov + : need multiple response Well, I looked in the help page to manova and it transferred me to a summary.manova help page with example which seems to organize multiple respodse to a matrix. So I presume Y- cbind(isol,hcom,habarea,inclin,windprot,shrubcov,herbh,baregr,flowcov) and manova(Y~pcor, data=pcor.df) should work as expected, hopefully. Cheers Petr Can someone help me? Thanks Steffi Stefanie von Felten Kppelistrasse 24 4600 Olten Tel: 062/296 13 14 e-mail: [EMAIL PROTECTED] [[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 Petr Pikal [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] nls and R scoping rules
Prof Brian Ripley wrote: On Thu, 10 Jun 2004, Prof Brian Ripley wrote: Around R 1.2.x the notion was introduced that variables should be looked for in the environment of a formula. Functions using model.frame got converted to do that, but nls did not. I guess that the best way forward is to ensure that nls (and nlsModel) does search the environment of the formula for functions. It transpires that is rather easy to achieve. At the top of nlsModel and nlsModel.plinear use env - new.env(parent=environment(form)) instead of env - new.env() This then automatically searches for objects used in the formula Notes 1) nls is in a namespace, so you need to fix the copy in the namespace or fix the source code and rebuild. 2) This will add to the baggage needed when you save() a nls fit in a workspace. I think that is inevitable as we cannot just identify the funtions used in the formula (as they might call other functions in the local environment), and it is necessary to capture the objects needed to evaluate the formula for the predict() method to be reliable. We could call all.names() to get the names of functions used directly in the formula, but that seems not good enough (previous para). Question to the cognescenti: is the price in 2) too great for this to be done for 1.9.1? I will put the change in R-devel for now. thank's a lot for the two responses. that seems exactly what helps me out. remaining question: how can I edit (I mean from within R, not by messing around with the source code directly) an invisible function object such as nlsModel.plinear? help.search('invisible'), help('function'), help('edit') at least did not tell me. joerg __ [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] nls and R scoping rules
On Thu, 10 Jun 2004, joerg van den hoff wrote: Prof Brian Ripley wrote: On Thu, 10 Jun 2004, Prof Brian Ripley wrote: Around R 1.2.x the notion was introduced that variables should be looked for in the environment of a formula. Functions using model.frame got converted to do that, but nls did not. I guess that the best way forward is to ensure that nls (and nlsModel) does search the environment of the formula for functions. It transpires that is rather easy to achieve. At the top of nlsModel and nlsModel.plinear use env - new.env(parent=environment(form)) instead of env - new.env() This then automatically searches for objects used in the formula Notes 1) nls is in a namespace, so you need to fix the copy in the namespace or fix the source code and rebuild. 2) This will add to the baggage needed when you save() a nls fit in a workspace. I think that is inevitable as we cannot just identify the funtions used in the formula (as they might call other functions in the local environment), and it is necessary to capture the objects needed to evaluate the formula for the predict() method to be reliable. We could call all.names() to get the names of functions used directly in the formula, but that seems not good enough (previous para). Question to the cognescenti: is the price in 2) too great for this to be done for 1.9.1? I will put the change in R-devel for now. thank's a lot for the two responses. that seems exactly what helps me out. remaining question: how can I edit (I mean from within R, not by messing around with the source code directly) an invisible function object such as nlsModel.plinear? help.search('invisible'), help('function'), help('edit') at least did not tell me. It depends why they are hidden, but for functions not exported from a namespace see ?fixInNamespace (hence my comment about namespaces). -- 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] Table to Data Frame
Ko-Kang Kevin Wang wrote: [Forwarding on behalf of a colleague] She's got a list with several tables: tab - list() for(i in 1:6) { Most easy solution: Make freq[i] a factor with all the levels that may appear. Then all tables have same dimension, e.g.: tab - lapply(freq, function(x) table( factor(x, levels = c(0, 0.17, 0.3, 0.5, 1, 2.5, 3, 4 Simplify yourself - I don't know much about freq ... Uwe + tab[[i]] - table(freq[i]) + } tab [[1]] 0 0.17 0.3 0.51 2.534 1962515252 [[2]] 0 0.17 0.31 2.534 199136261 [[3]] 0 0.5 217 1 [[4]] 0 2.5 216 2 [[5]] 0 0.17 0.3 0.51 2.534 2071111241 [[6]] 0 0.173 21611 And would like to convert to a data frame, like: 0 0.17 0.3 0.5 1 1962 5 1 5 1991 3 0 6 2170 0 1 0 [snip] Basically down the columns she'd like to have the counts. But because each table in the list has got different number of columns, I've been unable to convert them into a data frame for her. Any help would be greatly appreciated! Cheers, Kevin __ [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] Table to Data Frame
Hi! First as Uwe Ligges explained and finally. do.call(rbind,tab) Sincerely Eryk *** REPLY SEPARATOR *** On 6/10/2004 at 10:17 PM Ko-Kang Kevin Wang wrote: [Forwarding on behalf of a colleague] She's got a list with several tables: tab - list() for(i in 1:6) { + tab[[i]] - table(freq[i]) + } tab [[1]] 0 0.17 0.3 0.51 2.534 1962515252 [[2]] 0 0.17 0.31 2.534 199136261 [[3]] 0 0.5 217 1 [[4]] 0 2.5 216 2 [[5]] 0 0.17 0.3 0.51 2.534 2071111241 [[6]] 0 0.173 21611 And would like to convert to a data frame, like: 0 0.17 0.3 0.5 1 1962 5 1 5 1991 3 0 6 2170 0 1 0 [snip] Basically down the columns she'd like to have the counts. But because each table in the list has got different number of columns, I've been unable to convert them into a data frame for her. Any help would be greatly appreciated! Cheers, Kevin __ [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 Dipl. bio-chem. Eryk Witold Wolski@MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin 'v' tel: 0049-30-83875219 / \ mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski __ [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] Clustering Categorial and Continuous Variables
Hi there fellow R users, R has many different clustering packages (e.g. mclust,cluster,e1071). However, can anyone recommend a method to deal with data sets that contain categorial and continuous variables? Regards Wayne KSS Ltd Seventh Floor St James's Buildings 79 Oxford Street Manchester M1 6SS England Company Registration Number 2800886 Tel: +44 (0) 161 228 0040 Fax: +44 (0) 161 236 6305 mailto:[EMAIL PROTECTED]http://www.kssg.com The information in this Internet email is confidential and m...{{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] Table to Data Frame
# Generate data universe - c(0, 0.17, 0.5, 1, 2.5, 3, 4) prob - c(94, 1, 1, 1, 1, 1, 1)/1000 tab - list(NULL) for(i in 1:6){ tab[[i]] - table(sample(universe, 218, prob=prob, rep=TRUE)) } # Re-table all - unique(unlist(sapply(tab, function(x) names(x retab - t(sapply( tab, function(x) table( factor( rep( rownames(x), x) , levels=all The key is to have the exactly the same names (stored in object all) in all table and sapply will simplify it. Uwe suggestion is probably best if you can regenerate the data. Regards, Adai. On Thu, 2004-06-10 at 11:50, Uwe Ligges wrote: Ko-Kang Kevin Wang wrote: [Forwarding on behalf of a colleague] She's got a list with several tables: tab - list() for(i in 1:6) { Most easy solution: Make freq[i] a factor with all the levels that may appear. Then all tables have same dimension, e.g.: tab - lapply(freq, function(x) table( factor(x, levels = c(0, 0.17, 0.3, 0.5, 1, 2.5, 3, 4 Simplify yourself - I don't know much about freq ... Uwe + tab[[i]] - table(freq[i]) + } tab [[1]] 0 0.17 0.3 0.51 2.534 1962515252 [[2]] 0 0.17 0.31 2.534 199136261 [[3]] 0 0.5 217 1 [[4]] 0 2.5 216 2 [[5]] 0 0.17 0.3 0.51 2.534 2071111241 [[6]] 0 0.173 21611 And would like to convert to a data frame, like: 0 0.17 0.3 0.5 1 1962 5 1 5 1991 3 0 6 2170 0 1 0 [snip] Basically down the columns she'd like to have the counts. But because each table in the list has got different number of columns, I've been unable to convert them into a data frame for her. Any help would be greatly appreciated! Cheers, Kevin __ [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
Re: [R] Clustering Categorial and Continuous Variables
Hi! You need a apropriate dissimilarity measure. look for daisy in package cluster help(daisy,package=cluster) x: numeric matrix or data frame. Dissimilarities will be computed between the rows of 'x'. Columns of mode 'numeric' (i.e. all columns when 'x' is a matrix) will be recognized as interval scaled variables, columns of class 'factor' will be recognized as nominal variables, and columns of class 'ordered' will be recognized as ordinal variables. Other variable types should be specified with the 'type' argument. Missing values ('NA's) are allowed. ... Fore example Gower 1971 proposed a coefficient for variables of different type(?) categorial continous binary. sincerely Eryk *** REPLY SEPARATOR *** On 6/10/2004 at 11:52 AM Wayne Jones wrote: Hi there fellow R users, R has many different clustering packages (e.g. mclust,cluster,e1071). However, can anyone recommend a method to deal with data sets that contain categorial and continuous variables? Regards Wayne KSS Ltd Seventh Floor St James's Buildings 79 Oxford Street Manchester M1 6SS England Company Registration Number 2800886 Tel: +44 (0) 161 228 0040Fax: +44 (0) 161 236 6305 mailto:[EMAIL PROTECTED] http://www.kssg.com The information in this Internet email is confidential and m...{{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 Dipl. bio-chem. Eryk Witold Wolski@MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin 'v' tel: 0049-30-83875219 / \ mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski __ [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 with plotmath
There must be a simple answer. I want to plot an expression, where the expression is held in a string variable. The obvious solution along the lines of ex-x^2 plot( c(0,1), c(0,1), main=as.expression(ex) ) gives me the a title x^2 - ie doesn't treat it like an expression. I suspect I don't understand expressions properly. For the real problem I do need to have my expression string in a variable as it is data-dependent. Can someone tell me the magic words? Steve Dr Steve Roberts [EMAIL PROTECTED] Senior Lecturer in Medical Statistics, CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161 275 5192 / 0161 276 5785 __ [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] Help with plotmath
You *parse* strings to form expressions. plot( c(0,1), c(0,1), main=parse(text=ex) ) On Thu, 10 Jun 2004, Steve Roberts wrote: There must be a simple answer. I want to plot an expression, where the expression is held in a string variable. The obvious solution along the lines of ex-x^2 plot( c(0,1), c(0,1), main=as.expression(ex) ) gives me the a title x^2 - ie doesn't treat it like an expression. I suspect I don't understand expressions properly. For the real problem I do need to have my expression string in a variable as it is data-dependent. You might also want to explore substitute. Can someone tell me the magic words? -- 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] moving data and output?
Am 09.06.2004 22:23:51 schrieb(en) Peter Alspach: 2. How can I make outputs of the grafics (plot, hist, ...) into a file? what platform (Windows or Unix)? Unix. (Gentoo Linux in special) Martin __ [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] Help with plotmath
Hi On 10 Jun 2004 at 12:28, Steve Roberts wrote: There must be a simple answer. I want to plot an expression, where the expression is held in a string variable. The obvious solution along the lines of ex-x^2 plot( c(0,1), c(0,1), main=as.expression(ex) ) Plotmath example led me to ex-expression(x^2) plot( c(0,1), c(0,1), main=(ex) ) hope it is what you want. Cheers Petr gives me the a title x^2 - ie doesn't treat it like an expression. I suspect I don't understand expressions properly. For the real problem I do need to have my expression string in a variable as it is data-dependent. Can someone tell me the magic words? Steve Dr Steve Roberts [EMAIL PROTECTED] Senior Lecturer in Medical Statistics, CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161 275 5192 / 0161 276 5785 __ [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 Petr Pikal [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] question related to S-Plus
Hi Rick, learning R. A question to this end, though. Would all of my existing S-Plus arrays, functions, and so on have to be re-created from scratch in R, or is there a way to copy them into the .RData directory? The answer to this question has major I am not sure if you have had this answered already. You definitely cannot just copy the binary objects into a .RData workspace. On the S-PLUS side, I would try ?data.dump (and particularly, its argument oldStyle if you have S3/S-PLUS 2000 or earlier objects), and/or ?dput to get your S-PLUS objects exported to ASCII format. Then from the R side, see ?source and ?dget to import things into R objects. I do not recall off-hand what the best combinations and argument settings are for the most common situations. But I recall the reliability being pretty high in my practice if not perfect, which is more than I could ask for. I'd also like to suggest that if you do not already, you might want to make a habit to use and keep files of source code with objects that you create, especially functions and calls to create data.frames, etc As wonderful as R is, I find S-PLUS is still needed a lot in my work, so when you need to work with both, having a file of the source commands is most convenient (actually, I personally find it absolutely essential). Hope that helps. Bill --- Bill Pikounis, Ph.D. Biometrics Research Department Merck Research Laboratories PO Box 2000, MailDrop RY33-300 126 E. Lincoln Avenue Rahway, New Jersey 07065-0900 USA Phone: 732 594 3913 Fax: 732 594 1565 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rick Picard Sent: Wednesday, June 09, 2004 12:58 PM To: [EMAIL PROTECTED] Subject: [R] question related to S-Plus Dear r-help, Having used S-Plus for many years, it has been suggested to me that I could benefit from learning R. A question to this end, though. Would all of my existing S-Plus arrays, functions, and so on have to be re-created from scratch in R, or is there a way to copy them into the .Rdata directory? The answer to this question has major implications for the extent to which R is attractive in the near term, and any enlightenment would be much appreciated. Thanks, Rick Picard __ [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] ordered probit or logit / recursive regression
I make a study in health econometrics and have a categorical dependent variable (take value 1-5). I would like to fit an ordered probit or ordered logit but i didn't find a command or package who make that. Does anyone know if it's exists ? other question : i would like to make a least square recursive regression. Is there a special command in R ? Thanks for your answers. Best regards, ** Mathieu Vuilleumier - collaborateur scientifique Institut de recherches économique et régionale (IRER) Université de Neuchâtel Pierre-à-Mazel 7, CH-2000 Neuchâtel Tel : 032/ 718 14 66 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] question related to S-Plus
On Thu, 10 Jun 2004, Pikounis, Bill wrote: Hi Rick, learning R. A question to this end, though. Would all of my existing S-Plus arrays, functions, and so on have to be re-created from scratch in R, or is there a way to copy them into the .RData directory? The answer to this question has major I am not sure if you have had this answered already. You definitely cannot just copy the binary objects into a .RData workspace. On the S-PLUS side, I would try ?data.dump (and particularly, its argument oldStyle if you have S3/S-PLUS 2000 or earlier objects), and/or ?dput to get your S-PLUS objects exported to ASCII format. Then from the R side, see ?source and ?dget to import things into R objects. I do not recall off-hand what the best combinations and argument settings are for the most common situations. But I recall the reliability being pretty high in my practice if not perfect, which is more than I could ask for. To clarify that a bit. For functions, use dump() in S-PLUS and source() in R. For data objects such as arrays and data frames use data.dump(oldStyle=T) (assuming S-PLUS 5.x or 6.x, otherwise just data.dump) in S-PLUS and data.restore in package foreign to read in. (That will help keep precision, use integers as appropriate etc.) Also, R does have an `R Data Import/Export Manual' which elaborates on such issues. It is possible to read S-PLUS 4.x (or earlier) objects using package foreign, but there is less error checking. -- 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] ordered probit or logit / recursive regression
On Thu, 10 Jun 2004, VUILLEUMIER Mathieu wrote: I make a study in health econometrics and have a categorical dependent variable (take value 1-5). I would like to fit an ordered probit or ordered logit but i didn't find a command or package who make that. Does anyone know if it's exists ? Does polr in package MASS or lrm in package Design do what you want? -- 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] nls and R scoping rules
On Thu, 10 Jun 2004, Prof Brian Ripley wrote: On Thu, 10 Jun 2004, Prof Brian Ripley wrote: Around R 1.2.x the notion was introduced that variables should be looked for in the environment of a formula. Functions using model.frame got converted to do that, but nls did not. I guess that the best way forward is to ensure that nls (and nlsModel) does search the environment of the formula for functions. It transpires that is rather easy to achieve. At the top of nlsModel and nlsModel.plinear use env - new.env(parent=environment(form)) instead of env - new.env() This then automatically searches for objects used in the formula Notes 1) nls is in a namespace, so you need to fix the copy in the namespace or fix the source code and rebuild. 2) This will add to the baggage needed when you save() a nls fit in a workspace. I think that is inevitable as we cannot just identify the funtions used in the formula (as they might call other functions in the local environment), and it is necessary to capture the objects needed to evaluate the formula for the predict() method to be reliable. We could call all.names() to get the names of functions used directly in the formula, but that seems not good enough (previous para). Question to the cognescenti: is the price in 2) too great for this to be done for 1.9.1? I will put the change in R-devel for now. I don't think so. The fit objects already contain the formula (via the environment of the functions in the structure). Since environment sharing is preserved within a serialization, this means the change would only alter the parent of the env environment, not add anything extra. Best, luke -- Luke Tierney University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: [EMAIL PROTECTED] Iowa City, IA 52242 WWW: http://www.stat.uiowa.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] how to initialize random seed properly ?
Here is my best solution so far using $RANDOM in bash or maybe somebody has pure R solution ? #!/bin/bash for i in 1 2; do p=tmp$i cat $p.R EOF set.seed($RANDOM) cat('rnorm(3) =', rnorm(3), '\n') EOF nice R CMD BATCH --no-save --no-restore $p.R $p.log done sleep 3 grep rnorm tmp[12].log Best regards, Ryszard Ryszard Czerminski/PH/[EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 06/09/2004 03:24 PM To: [EMAIL PROTECTED] cc: Subject:[R] how to initialize random seed properly ? I want to start R processes on multiple processors from single shell script and I want all of them to have different random seeds. One way of doing this is sleep 2 # (with 'sleep 1' I am often getting the same number) ... set.seed(unclass(Sys.time())) Is there a simpler way without a need to sleep between invoking different R processes ? Ryszard __ [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] Help with plotmath
No that isn't it I'm afraid - my expression is pasted together from various bits and pieces and is at some stage a string variable. I needed parse as Brian pointed out Thanks anyway, Steve. From: Petr Pikal [EMAIL PROTECTED] To: Steve Roberts [EMAIL PROTECTED] Date sent: Thu, 10 Jun 2004 13:44:21 +0200 Subject:Re: [R] Help with plotmath Copies to: [EMAIL PROTECTED] Priority: normal Hi On 10 Jun 2004 at 12:28, Steve Roberts wrote: There must be a simple answer. I want to plot an expression, where the expression is held in a string variable. The obvious solution along the lines of ex-x^2 plot( c(0,1), c(0,1), main=as.expression(ex) ) Plotmath example led me to ex-expression(x^2) plot( c(0,1), c(0,1), main=(ex) ) hope it is what you want. Cheers Petr gives me the a title x^2 - ie doesn't treat it like an expression. I suspect I don't understand expressions properly. For the real problem I do need to have my expression string in a variable as it is data-dependent. Can someone tell me the magic words? Steve Dr Steve Roberts [EMAIL PROTECTED] Senior Lecturer in Medical Statistics, CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161 275 5192 / 0161 276 5785 __ [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 Petr Pikal [EMAIL PROTECTED] Dr Steve Roberts [EMAIL PROTECTED] Senior Lecturer in Medical Statistics, CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161 275 5192 / 0161 276 5785 __ [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] lsoda with arbitrary zero thresholds (with psuedo-solution)
Dear Hank, Last question first: really, only you can say for sure if 4e-281 and 5e-11 are small enough; it depends on the units you measure your state variables in. However, this strategy cannot get the state variables to exactly 0. Obviously, you could get closer to 0.0 faster by setting the derivatives even larger in absolute value. You may run into problems with the solver when the derivatives are discontinuous functions of the state variables. There is a simple and elegant solution in theory, but not (yet) available in odesolve. soda has a variant called lsodar that returns whenever a function of the state variables satisfies a given set of conditions (in your case, you could tell lsodar to return whenever any state variable drops below 0.4). Once the call to lsodar returns, you'd then reset all the state variables that were 0.4 to 0, and restart the integrator at that point. I've been meaning to add lsodar to the odesolve package for some time, but I never seem to have the week or so of time I'd need to do it. You can simulate the action of lsodar by breaking your simulation in short sections, and doing a search to identify time intervals where a state variable drops below its critical value (that is, suppose you note that at t1 y[1] 0.4, and at t3, y[1] 0.4]; then search the time interval between t1 and t3 for the value where abs(y[1] - 0.4) eps, say t2 ). Stop the current integration at t2, change the state variables, and restart. For any given problem, you'd probably have to experiment with time reporting intervals (the intervals between points in the 'times' vector) so as not to miss any important events. Woody On Jun 9, 2004, at 1:43 PM, Martin Henry H. Stevens wrote: I have a new and less distressing, but potentially more interesting, problem. I realized the major flaw my old solution and now have a solution that kind of works but is rather inelegant and I think may be problematic in difficult systems. Borrowing from the lsoda example again I once again highlight the code that I have changed to put in place arbitrary thresholds: parms - c(k1=0.04, k2=1e4, k3=3e7) my.atol - c(1e-6, 1e-10, 1e-6) times - seq(0,1000) lsexamp - function(t, y, p) { if(y[1] .4) yd1 - -y[1] ### These if, else statements are new else yd1 - -p[k1] * y[1] + p[k2] * y[2]*y[3] if(y[3] .4) yd3 - -y[3] ### These if,else statements are new else yd3 - p[k3] * y[2]^2 list(c(yd1,-yd1-yd3,yd3),c(massbalance=sum(y))) } out - lsoda(c(.5,0,.5),times,lsexamp, parms, rtol=1e-4, atol= my.atol, hmax=.1) matplot(out[,1],out[,2:5], type=l) out[dim(out)[1],] # The intent of my could was to cause population 1 to fall to zero as soon as it reached 0.4. However, the populations 1 and 2 reach approximations of 0 (4e-281 and 5e-11). So, I have two questions: Can I set thresholds in a more elegant and simpler way? Are the approximate zero values close enough? Thank you kindly, as ever. Sincerely, Hank On Jun 9, 2004, at 12:45 PM, Martin Henry H. Stevens wrote: using R 2.0.0 I am trying to do some population modeling with lsoda, where I set arbitrary zero population sizes when values get close to zero, but am having no luck. As an example of what I have tried, I use code below from the help page on lsoda in which I include my modification bordered by ### parms - c(k1=0.04, k2=1e4, k3=3e7) my.atol - c(1e-6, 1e-10, 1e-6) times - seq(0,) lsexamp - function(t, y, p) { ### The next line is where I try to insert the threshold ifelse(y 0.4, 0, y) ## all else is unchanged yd1 - -p[k1] * y[1] + p[k2] * y[2]*y[3] yd3 - p[k3] * y[2]^2 list(c(yd1,-yd1-yd3,yd3),c(massbalance=sum(y))) } out - lsoda(c(.5,0,.5),times,lsexamp, parms, rtol=1e-4, atol= my.atol) # Initial values differ from help page matplot(out[,1],out[,2:5], type=l) out[dim(out)[1],] # The intent of my could was to cause population 1 to fall to zero as soon as it reached 0.4 Any thoughts would be appreciated. Thanks! Hank Stevens Dr. Martin Henry H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/botany/bot/henry.html http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum R. Woodrow Setzer, Jr.Phone: (919) 541-0128 Experimental Toxicology Division Fax: (919) 541-4284 Pharmacokinetics Branch NHEERL B143-01; US EPA; RTP, NC 27711 __ [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 initialize random seed properly ?
perldoc -f srand has a quick and good advice on initializing a random sequence. I second the recommendation to prepare the list of random numbers in advance for sake of reproducibility. Itay -- [EMAIL PROTECTED] Fred Hutchinson Cancer Research Center __ [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 initialize random seed properly ?
[EMAIL PROTECTED] writes: Here is my best solution so far using $RANDOM in bash or maybe somebody has pure R solution ? Sure -- use the rsprng or rlecuyer packages from CRAN, which support (independent?) streams of random numbers from a common set of seeds. best, -tony -- [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
[R] Response to questions raised in Mar 17 reply
Hi, I would like to repsond to a few questions raised in a reply to a question posted by another user on March 17, 2004. The entire message is copied at the end of this email. The relevant questions and statements are as follows: What did you not understand about help(memory.size)? This is also in the rw-FAQ: what in that did you not understand? ... Yes, so try a machine with 2Gb RAM. I have received the Error: cannot allocate vector of size xxx Kb many times and have scoured the R help files (?memory.limit), the R help archive pages, and the R-W FAQs. The following issues are what I specifically do not understand about the help information available to address memory issues: 1) In ?memory.limit, it is stated that memory.size(max=TRUE) will return the maximum amount of memory obtained from the operating system. However, my system returns only 1.57 GB of maximum memory, even though under System Properties in Windows XP the operating system reports 2.5 GB on the system. 2)In ?memory.limit, it is stated that memory.limit(size=NA) will report the memory size, but is this the available memory, the total, or the amount in use? If it is the total, how is it different from memory.size(max=TRUE)? On my system the result of the three relevant memory functions are as follows: MemSizeinGB=(memory.limit(size=NA))/1E9 MaxMemGB=(memory.size(max=T))/1E9 MemInUseGB=(memory.size(max=F))/1E9 MemSizeinGB [1] 4.246733 MaxMemGB [1] 1.567990 MemInUseGB [1] 0.7674916 3)I have used the --max-mem-size option in the icon properties, shortcut tab, target field after the pathname of the executable, and this appears to have increased the result of memory.limit(size=NA). However, even with the memory.limit set to 4.24 GB, I receive the Error: cannot allocate vector of 135154 Kb when trying to fit a GAM to some temperature data. How was the 2 GB quantity determined in the reply below? Is there a rule of thumb for determining how much memory will be needed for a specific vector size? Thanks very much, Jeff Yanosky Harvard School of Public Health On Wed, 17 Mar 2004, Matt Loveland wrote: I'm having trouble with glmmPQL. I think you are having trouble with memory limits, actually. As the author of glmmPQL, I don't appreciate my code being blamed for something else. I'm fitting a 2 level random intercept model, with 90,000 cases and about 330 groups. I'm unable to get any results on the full data set. I can get it to work if I sample down to about 30,000 cases. But for models with N's much larger than that I get the following warning message: m3=glmmPQL(prepfood~iage+iemployed+iwhite+ieduclevl+imarried+servcomm+leadgrup +leadsty4, family=binomial, random=~1|congrega1,data=data) Error: cannot allocate vector of size 4135 Kb In addition: Warning message: Reached total allocation of 253Mb: see help(memory.size) I've tried increasing my virtual memory size, and also defragmenting my hard drive. It hasn't helped. I've seen other people asking similar questions on the archive, but it seems that this problem should have gone away after earlier versions of R, is that right? Do read the page it asks you too. You are on Windows, and you need to use the --max-mem-size flag when starting R to increase the memory available to R. However, if you do swapping may make your machine nigh unusable. What did you not understand about help(memory.size)? This is also in the rw-FAQ: what in that did you not understand? Is this a data problem, am I fitting a bad model, or is it a memory size problem. I'm hoping the last one, and any help is appreciated. Yes, so try a machine with 2Gb RAM. -- 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] Lattice::qqmath -- groups option question
Does the 'groups' option on qqmath just color the points differently in the main distribution or does it actually overlay separate quantile plots for each subset? I would like to be able to do the latter. --Rich Richard Kittler AMD TDG 408-749-4099 __ [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] Lattice::qqmath -- groups option question
On Thursday 10 June 2004 09:21, [EMAIL PROTECTED] wrote: Does the 'groups' option on qqmath just color the points differently in the main distribution or does it actually overlay separate quantile plots for each subset? I would like to be able to do the latter. The 'groups' option doesn't really do anything in any of the high level lattice functions, it just sends the groups variable (and associated subscripts) to the panel function. It is the panel function that needs to know how to deal with that information. As things stand now, panel.qqmath doesn't know what to do with it. More importantly, qqmath is currently structured in a way that would make this very difficult to implement. I don't think there's a good reason for this (other than consistency with S-PLUS) and I would prefer to allow the possibility of grouped Q-Q plots. But this would need a fair bit of restructuring and will certainly not happen before R 2.0.0. 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] Informal discussion group about R
I've started a tribe for discussing R and sharing scripts. Tribe.net is one of the popular on-line social communities, like Friendster. Visit and see if it is a forum that you find useful. To join the tribe you will need to register with Tribe.net. I hope it will be of help to newbies, although I'm new to R myself. Here is the url: http://r-statisticalenvironment.tribe.net Harold __ [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] Building package on Windows: No rule to make target '-llapack'
On Thu, 2004-06-10 at 06:40, Prof Brian Ripley wrote: On Wed, 9 Jun 2004, Zhu Wang wrote: I have a problem to build a package on Windows XP while there is no problem on Linux. The Makefile is something like: There would be a problem on Linux, if that Makefile were used. I suspect it is not used. Believe or not, it works. ### LIBNAME=cts PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) (You should not need $(FLIBS) here.) OBJS=file1.o ... file20.o -llapack -lblas The last two are not objects, and -llapack refers to something like liblapack.a. I don't see how this can work anywhere. On the other hand, you have lapack and blas selected in PKG_LIBS, but you are not using that macro. I did this because I did not find good examples about how to link Lapack and Blas using R. So I tried this and it works. $(LIBNAME)$(SHLIB_EXT): $(OBJS) $(SHLIB_LD) $(SHLIB_LDFLAGS) -o $@ $(OBJS) $(FLIBS) clean: @rm -f *.o *.$(SHLIB_EXT) realclean: clean # To build the package on Windows XP, I have followed the instructions to install tools/software required and it seems the 'make' worked fine, except for the error message: make[3]: No rule to make target 'llapack', needed by 'cts.a'. stop. Now I think maybe two problems: one is that maybe I do not have Lapack and Blas installed on Windows XP and second is that I do not set up a correct file, something like 'configure'. Maybe there are more problems. I have read some files in \src\gnuwin32, but I did not find what I needed. What are you actually trying to do? It is not normal for a package to have a Makefile in its src directory, which is what I guess (but only guess) you have presented. All that is normally needed is a Makevars file. Take a look at e.g. that in mclust. I did find an R package which uses Makefile in its src directory, and I just happened to be familiar with. But it was on the author's website and not on CRAN. Maybe that's a bad example. I will take a look at that in mclust. Is this your package or someone else's (in which case why are you not asking the author)? Either you or that author needs to read `Writing R Extensions' and look at some of the many examples in CRAN packages. This is mine. I agree with you. Certainly there are more stuff I need to know about 'Writing R Extensions'. The package is on my website, see below. Using the following: #R CMD check cts #R CMD INSTALL cts I have successfully installed the package. Thanks for your advice. On the other hand, it might be a successful story how R is robust! -- Zhu Wang Statistical Science Department Southern Methodist University Dallas, TX 75275-0332 Phone:(214)768-2453 Fax:(214)768-4035 [EMAIL PROTECTED] http://people.smu.edu/zhuw __ [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] Everything was ok, but I failed to get .o file in g77
Hi folks, I tried to compile a FORTRAN routine using the command g77 o2 c all.f, it seems everything is fine, there is no error message at all, but finally I can not get the file all.o. Therefore, I can not move on to the next step using g77 shared c all.dll all.o to get the file all.dll. The following is what happened on my screen: g77 o2 c all.f Could anyone help me? Thanks in advance. Rui Phone: (403)220-4501 Email: [EMAIL PROTECTED] Department of Mathematics and Statistics University of Calgary [[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] Lattice::qqmath -- groups option question
Thanks for the info. Given that I rule out qqmath would the best method be to make repeated calls to qqnorm without plotting and then overlay the results or is there a more elegant method? --Rich Richard Kittler AMD TDG 408-749-4099 -Original Message- From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] Sent: Thursday, June 10, 2004 7:55 AM To: [EMAIL PROTECTED] Cc: Kittler, Richard Subject: Re: [R] Lattice::qqmath -- groups option question On Thursday 10 June 2004 09:21, [EMAIL PROTECTED] wrote: Does the 'groups' option on qqmath just color the points differently in the main distribution or does it actually overlay separate quantile plots for each subset? I would like to be able to do the latter. The 'groups' option doesn't really do anything in any of the high level lattice functions, it just sends the groups variable (and associated subscripts) to the panel function. It is the panel function that needs to know how to deal with that information. As things stand now, panel.qqmath doesn't know what to do with it. More importantly, qqmath is currently structured in a way that would make this very difficult to implement. I don't think there's a good reason for this (other than consistency with S-PLUS) and I would prefer to allow the possibility of grouped Q-Q plots. But this would need a fair bit of restructuring and will certainly not happen before R 2.0.0. 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
Re: [R] Everything was ok, but I failed to get .o file in g77
I am afraid your message is in an unreadable character set and none was specified by your mailer. So I don't really know what you used, but I have ^V where - should be, and so on. What you would need is g77 -O2 -c all.f ^ note You appear to have asked for a file '2' here via -o2. g77 -shared -o all.dll all.o -lg2c ^ note ^ note It is much less error-prone to use R CMD SHLIB all.f under Unix-alikes Rcmd SHLIB all.funder Windows On Thu, 10 Jun 2004, Rui wrote: Hi folks, I tried to compile a FORTRAN routine using the command g77 o2 c all.f, it seems everything is fine, there is no error message at all, but finally I can not get the file all.o. Therefore, I can not move on to the next step using g77 shared c all.dll all.o to get the file all.dll. The following is what happened on my screen: g77 o2 c all.f Could anyone help me? Thanks in advance. -- 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] odesolve: lsoda vs rk4
I'm trying to use odesolve for integrating various series of coupled 1st order differential equations (derived from a system of enzymatic catalysis and copied below, apologies for the excessively long set of parameters). The thing that confuses me is that, whilst I can run the function rk4: out - rk4(y=y,times=times,func=func, parms=parms) and the results look not unreasonable: out-as.data.frame(out) par(mfrow=c(4,1)) for (i in 2:(dim(out)[2]))plot(out[,1],out[,i], pch=., xlab=time, ylab=names(out)[i]) If I try doing the same thing with lsoda: out - lsoda(y=y,times=times,func=func, parms=parms, rtol=1e-1, atol= 1e-1) I run into problems with a series of 'Excessive precision requested' warnings with no output beyond the first time point. Fiddling with rtol and atol doesn't seem to do very much. What is likely to be causing this (I'm guessing the wide range of the absolute values of the parameters can't be helping), is there anything I can sensibly do about it and, failing that, can I reasonably take the rk4 results as being meaningful? Any help much appreciated, Thanks in advance, Chris func - function(t, y, p) { Ad - p[p2]*(p[p1]*y[A]*y[D])/(p[p2]+p[p3]) + p[p6]*(p[p4]*y[B]*p[p10])/(p[p5]+p[p6]) - p[p1]*y[A]*y[C] Bd - p[p3]*(p[p1]*y[A]*y[D])/(p[p2]+p[p3]) + p[p5]*(p[p4]*y[B]*p[p10])/(p[p5]+p[p6]) - p[p4]*y[B]*p[p10] Cd - (p[p1]+p[p7])*y[A]*y[D] - p[p1]*y[A]*y[C]-p[p9]*y[C] Dd -p[p9]*y[C] - p[p7]*y[A]*y[D] list(c(Ad, Bd, Cd, Dd)) } parms-c(p1=4.8e5, p2=1.25, p3=1.3, p4=1e6, p5=1, p6=1.25, p7=1e6, p8=16, p9=0.35, p10=0.235e-6) y-c(A=2.5e-6,B=2.5e-6, C=1.7e-6, D=0.57e-6) times - c(0.05 * (0:999)) -- ~~ Dr. Christopher Knight Tel:+44 1865 275111 Dept. Plant Sciences +44 1865 275790 South Parks Road Oxford OX1 3RB Fax:+44 1865 275074 ` · . , ,(((º ~~ __ [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] Questions about Preserving registers
Hi folks, I tried to use Mirosoft Fortran Powerstation 4.0 to create a dll file. However, when I used the command dyn.load(test.dll), I got the following message: NULL Warning message: DLL attempted to change FPU control word from 9001f to 90003 I read the instruction on Duncan Murdochs website about preserving registers, but I still dont understand it. For example, 1. On first entry to the DLL, set the control word to the standard R value, then save that as the Delphi default. Put this code in the library module: ## My question: Is that mean put the following code in my Fortran routine without any change based on the message I got? procedure Rwin_fpset; cdecl; external 'R.dll'; function Get8087CW:word; begin asm fstcw result end; end; begin Rwin_fpset(); Set8087CW(Get8087CW); end. 2. After any operation that may have changed the status word, put this call before returning to R: ## My question: where do I put the line below? Set8087CW(Default8087CW); 3. The following function may be useful in debugging; it returns false when the control word has been unexpectedly changed: function Okay8087CW:boolean; begin result := ((Default8087CW xor Get8087CW) and not $E060) = 0; end; Thanks. Rui Phone: (403)220-4501 Email: [EMAIL PROTECTED] Department of Mathematics and Statistics University of Calgary [[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] Questions about Preserving registers
Rui wrote: Hi folks, I tried to use Mirosoft Fortran Powerstation 4.0 to create a dll file. And what is the reason not to use the recommended gcc? Uwe Ligges However, when I used the command dyn.load(test.dll), I got the following message: NULL Warning message: DLL attempted to change FPU control word from 9001f to 90003 I read the instruction on Duncan Murdochs website about preserving registers, but I still dont understand it. For example, 1. On first entry to the DLL, set the control word to the standard R value, then save that as the Delphi default. Put this code in the library module: ## My question: Is that mean put the following code in my Fortran routine without any change based on the message I got? procedure Rwin_fpset; cdecl; external 'R.dll'; function Get8087CW:word; begin asm fstcw result end; end; begin Rwin_fpset(); Set8087CW(Get8087CW); end. 2. After any operation that may have changed the status word, put this call before returning to R: ## My question: where do I put the line below? Set8087CW(Default8087CW); 3. The following function may be useful in debugging; it returns false when the control word has been unexpectedly changed: function Okay8087CW:boolean; begin result := ((Default8087CW xor Get8087CW) and not $E060) = 0; end; Thanks. Rui Phone: (403)220-4501 Email: [EMAIL PROTECTED] Department of Mathematics and Statistics University of Calgary [[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] displaying a table in full vs. typing variable name
I have a data frame called totaldata that is 10,000 rows by about 9 columns. The data frame contains many zero entries which are important. If I type totaldata it only prints out the first two columns. I expect (and want) it to print out all 9 columns. (I am actually sinking this to a text file, so imagine my surprise when the text file has only a few columns). I know totaldata contains all the data as summary(totaldata) lists what I expect (9 variables). Thanks for your help. [[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] Questions about Preserving registers
On Thu, 10 Jun 2004, Rui wrote: Hi folks, I tried to use Mirosoft Fortran Powerstation 4.0 to create a dll file. However, when I used the command dyn.load(test.dll), I got the following message: NULL Warning message: DLL attempted to change FPU control word from 9001f to 90003 I read the instruction on Duncan Murdochs website about preserving registers, but I still dont understand it. For example, This code is for Delphi. You would need to see how to set the FPU control work in Powerstation Fortran, which should be described in its manual. The warning is harmless, so you could just ignore it. The warning means that R has done the change for you. -thomas 1. On first entry to the DLL, set the control word to the standard R value, then save that as the Delphi default. Put this code in the library module: ## My question: Is that mean put the following code in my Fortran routine without any change based on the message I got? procedure Rwin_fpset; cdecl; external 'R.dll'; function Get8087CW:word; begin asm fstcw result end; end; begin Rwin_fpset(); Set8087CW(Get8087CW); end. 2. After any operation that may have changed the status word, put this call before returning to R: ## My question: where do I put the line below? Set8087CW(Default8087CW); 3. The following function may be useful in debugging; it returns false when the control word has been unexpectedly changed: function Okay8087CW:boolean; begin result := ((Default8087CW xor Get8087CW) and not $E060) = 0; end; Thanks. Rui Phone: (403)220-4501 Email: [EMAIL PROTECTED] Department of Mathematics and Statistics University of Calgary [[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 Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ [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] displaying a table in full vs. typing variable name
Rishi Ganti wrote: I have a data frame called totaldata that is 10,000 rows by about 9 columns. If about 9 equals 2, the behaviour reported below is expected. The data frame contains many zero entries which are important. If I type totaldata it only prints out the first two columns. I expect (and want) it to print out all 9 columns. Are you sure that R has not wrapped the data frame by printing the first few columns at first, and ended by printing the last 2 columns? This way the data fit into your window. You can set the width using options(), and get all columns at once. (I am actually sinking this to a text file, so imagine my surprise when the text file has only a few columns). Please consider to use write.table()! Uwe Ligges I know totaldata contains all the data as summary(totaldata) lists what I expect (9 variables). Thanks for your help. [[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] displaying a table in full vs. typing variable name
On Thu, 2004-06-10 at 11:26, Uwe Ligges wrote: Rishi Ganti wrote: I have a data frame called totaldata that is 10,000 rows by about 9 columns. If about 9 equals 2, the behaviour reported below is expected. That is, of course, for sufficiently large values of about... ;-) Marc __ [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] Lattice::qqmath -- groups option question
On Thursday 10 June 2004 10:38, [EMAIL PROTECTED] wrote: Thanks for the info. Given that I rule out qqmath would the best method be to make repeated calls to qqnorm without plotting and then overlay the results or is there a more elegant method? I don't think there's any good way currently. You could use densityplot (the reason to prefer that over xyplot is that the formula is similar, and the panel function would only be supplied an 'x' vector and no 'y' vector), with a custom prepanel and panel.groups functions that draw the Q-Q plot given the 'x' values. I don't have time to work out the details right now, but let me know if you have trouble getting it to work. 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
Re: [R] odesolve: lsoda vs rk4
Chris Knight [EMAIL PROTECTED] writes: I'm trying to use odesolve for integrating various series of coupled 1st order differential equations (derived from a system of enzymatic catalysis and copied below, apologies for the excessively long set of parameters). The thing that confuses me is that, whilst I can run the function rk4: . I run into problems with a series of 'Excessive precision requested' warnings with no output beyond the first time point. Fiddling with rtol and atol doesn't seem to do very much. . parms-c(p1=4.8e5, p2=1.25, p3=1.3, p4=1e6, p5=1, p6=1.25, p7=1e6, p8=16, p9=0.35, p10=0.235e-6) y-c(A=2.5e-6,B=2.5e-6, C=1.7e-6, D=0.57e-6) times - c(0.05 * (0:999)) I'm not going to dig deeply into your problem formulation, but my hunch is that you need to rescale your problem so that you get rid of the very small and large numbers in the parameters and starting values. Extreme values there tend to confuse convergence criteria. (The difference between the two solvers is probably exactly that lsoda has internal loops and convergence criteria, whereas rk4 just chugs along in fixed time steps.) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [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] Questions about Preserving registers
On Thu, 10 Jun 2004 09:12:05 -0700 (PDT), Thomas Lumley [EMAIL PROTECTED] wrote : DLL attempted to change FPU control word from 9001f to 90003 I read the instruction on Duncan Murdochs website about preserving registers, but I still dont understand it. For example, This code is for Delphi. You would need to see how to set the FPU control work in Powerstation Fortran, which should be described in its manual. The warning is harmless, so you could just ignore it. The warning means that R has done the change for you. I think it's better to try to fix it. R only checks once (on loading); if Fortran makes the change again, then R code might go wrong later, and if Fortran depends on the original value, then the Fortran code might not work properly. 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
Re: [R] off topic publication question
I always thought that the use of we was a reference to the author(s) and the reader. -roger Erin Hodgess wrote: Dear R People: Please excuse the off topic question, but I know that I'll get a good answer here. If a single author is writing a journal article, should she use We performed a test or I performed a test, please? I had learned to use we without regard to the number of authors. Is that true, please? Thanks for the off topic help. Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [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 __ [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 Describe R to Finance People
Thank you very much to those who contributed to this rather interesting discussion/debate. I was very surprised (and almost overwhelmed) by the volume of replies based on this topic! I have prepared some slides and put the draft version on www.stat.auckland.ac.nz/~kwan022/tmp/RFin.ppt. Feel free to download a copy if you are interested in what I am planning to use -- of course, any more suggestions are welcome but remember, it will only be a 1 ~ 2 minute talk on R *_* Cheers, Kevin __ [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] a scope problem
Hi, I have some code that looks like: dftc - df[sets$tcset,] pt - numeric(nrow(dftc)) sub - 1:nrow(dftc) for (i in 1:nrow(dftc)) { n - nnet( fmla, data=dftc, weights=wts, subset=sub[-i], size=4, decay=0.01) pt[i] - predict( n, dftc[ i, ], type='class' ) } However running this give me the error: Error in eval(expr, envir, enclos) : Object i not found I have noted this problem in some other instances. For example if I define a function f - function( dat, sets ) { # use sets } I sometimes get an error similar to that above. Does anybody know why this would happen? (R 1.9.0 on Fedora Core 2) --- Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- All laws are simulations of reality. -- John C. Lilly __ [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] tryCatch() and preventing interrupts in 'finally'
With tryCatch() it is possible to catch interrupts with tryCatch(). Then you can use a 'finally' statement to clean up, release resources etc. However, how can I protect against additional interrupts? This is a concern when the hold down Ctrl+C and generates a sequence of interrupts. Example: tryCatch({ cat(Press Ctrl+C...\n); Sys.sleep(5); }, interrupt = function(interrupt) { # ...and it will get caught cat(Caugh an interrupt:\n); print(interrupt); }, finally = { cat(Trying to finalize. Press Ctrl+C...\n); Sys.sleep(5); cat(...and this line will not be evaluated.\n); }) Additional tryCatch() inside 'finally' will have the same problem and so. One idea I had was to wrap up the 'finally' statement in a withCallingHandlers(, interrupt=...), but it seems that withCallingHandlers() does not catch interrupts. For example, I tried to replace 'tryCatch' with 'withCallingHandlers' in the above code. So, what I basically need is a way to turn off interrupts during the evaluation of 'finally' or a way for it to restart at the last interrupted point. Is this possible? Thanks (again)! Henrik Bengtsson Dept. of Mathematical Statistics @ Centre for Mathematical Sciences Lund Institute of Technology/Lund University, Sweden (+2h UTC) +46 46 2229611 (off), +46 708 909208 (cell), +46 46 2224623 (fax) h b @ m a t h s . l t h . s e, http://www.maths.lth.se/~hb/ __ [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] a scope problem
This looks like it probably is a scope problem with non-standard evaluation rules for the argument subset= of nnet. Instead of subset=sub[-i], try data=dftc[-i,] (I've not tested this since I don't have the data objects you used.) hope this helps, Tony Plate At Thursday 04:38 PM 6/10/2004, you wrote: Hi, I have some code that looks like: dftc - df[sets$tcset,] pt - numeric(nrow(dftc)) sub - 1:nrow(dftc) for (i in 1:nrow(dftc)) { n - nnet( fmla, data=dftc, weights=wts, subset=sub[-i], size=4, decay=0.01) pt[i] - predict( n, dftc[ i, ], type='class' ) } However running this give me the error: Error in eval(expr, envir, enclos) : Object i not found I have noted this problem in some other instances. For example if I define a function f - function( dat, sets ) { # use sets } I sometimes get an error similar to that above. Does anybody know why this would happen? (R 1.9.0 on Fedora Core 2) --- Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- All laws are simulations of reality. -- John C. Lilly __ [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] running R UNIX in a mac computer
Hi to you all My question is: there is a package written in UNIX for which there is no Mac version. I would like to know if it's possible to install the R UNIX version on the MacOSX and run that UNIX package on my Mac (through this UNIX R Vresion on a Mac) I have seen a porfile for r version 1.8.1 on darwin: http://r.darwinports.com/ is that it? aother question related to that if it's possible to use UNIX R in Mac, does anyone know how fast or how slow that is? thanks for any help! __ [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] running R UNIX in a mac computer
Hi: Please tell us: which Mac OS are you using? If you are using any of the 10.x, then you should download R-1.9.0 at: http://cran.us.r-project.org/bin/macosx If you have anything older (MacOS 9 or lower), then you should visit: http://cran.us.r-project.org/bin/macos Regards... On Thu, 10 Jun 2004, Tiago R Magalhaes wrote: Hi to you all My question is: there is a package written in UNIX for which there is no Mac version. I would like to know if it's possible to install the R UNIX version on the MacOSX and run that UNIX package on my Mac (through this UNIX R Vresion on a Mac) I have seen a porfile for r version 1.8.1 on darwin: http://r.darwinports.com/ is that it? aother question related to that if it's possible to use UNIX R in Mac, does anyone know how fast or how slow that is? thanks for any help! __ [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 -- Ulises M. Alvarez LAB. DE ONDAS DE CHOQUE FISICA APLICADA Y TECNOLOGIA AVANZADA UNAM [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] tryCatch() and preventing interrupts in 'finally'
More complete support for interrupt management is still on the to do list, unfortunately. onexit actions have similar issues (and have for a long time). What I was hoping to do is provide a user level mechanism for turning off interrupts around a piece of code and then optionally enabling them within the code. It may make sense to adopt that behavior for tryCatch as the detault, and maybe also for functions with onexit actions. There is a risk of deadlock if the cleanup code goes into an infinite loop, but this may be better than the current behavior of allowing interrutps in cleanup code. There are some nasty little issues involved in getting this right, which is why it hasn't happened yet. Best, luke On Fri, 11 Jun 2004, Henrik Bengtsson wrote: With tryCatch() it is possible to catch interrupts with tryCatch(). Then you can use a 'finally' statement to clean up, release resources etc. However, how can I protect against additional interrupts? This is a concern when the hold down Ctrl+C and generates a sequence of interrupts. Example: tryCatch({ cat(Press Ctrl+C...\n); Sys.sleep(5); }, interrupt = function(interrupt) { # ...and it will get caught cat(Caugh an interrupt:\n); print(interrupt); }, finally = { cat(Trying to finalize. Press Ctrl+C...\n); Sys.sleep(5); cat(...and this line will not be evaluated.\n); }) Additional tryCatch() inside 'finally' will have the same problem and so. One idea I had was to wrap up the 'finally' statement in a withCallingHandlers(, interrupt=...), but it seems that withCallingHandlers() does not catch interrupts. For example, I tried to replace 'tryCatch' with 'withCallingHandlers' in the above code. So, what I basically need is a way to turn off interrupts during the evaluation of 'finally' or a way for it to restart at the last interrupted point. Is this possible? Thanks (again)! Henrik Bengtsson Dept. of Mathematical Statistics @ Centre for Mathematical Sciences Lund Institute of Technology/Lund University, Sweden (+2h UTC) +46 46 2229611 (off), +46 708 909208 (cell), +46 46 2224623 (fax) h b @ m a t h s . l t h . s e, http://www.maths.lth.se/~hb/ __ [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 -- Luke Tierney University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: [EMAIL PROTECTED] Iowa City, IA 52242 WWW: http://www.stat.uiowa.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] running R UNIX in a mac computer
Hola ulisses thank you very much for replying to my posting I am using the last Mac Version: OS X 10.3 Panther I use R in the Mac and it works fine The thing is that I want to use a package that was made in UNIX and I wanted to know how easy it would be to run the UNIX version of R in the Mac so that I can use this package for UNIX... shouldn't you be watching soccer? some of my UNAM friends are nuts for a couple of days already! On Thu, 10 Jun 2004, Ulises Mora Alvarez wrote: Hi: Please tell us: which Mac OS are you using? If you are using any of the 10.x, then you should download R-1.9.0 at: http://cran.us.r-project.org/bin/macosx If you have anything older (MacOS 9 or lower), then you should visit: http://cran.us.r-project.org/bin/macos Regards... On Thu, 10 Jun 2004, Tiago R Magalhaes wrote: Hi to you all My question is: there is a package written in UNIX for which there is no Mac version. I would like to know if it's possible to install the R UNIX version on the MacOSX and run that UNIX package on my Mac (through this UNIX R Vresion on a Mac) I have seen a porfile for r version 1.8.1 on darwin: http://r.darwinports.com/ is that it? aother question related to that if it's possible to use UNIX R in Mac, does anyone know how fast or how slow that is? thanks for any help! __ [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 -- Ulises M. Alvarez LAB. DE ONDAS DE CHOQUE FISICA APLICADA Y TECNOLOGIA AVANZADA UNAM [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] running R UNIX in a mac computer
Hola! If you are already using Panther with R.dmg, then is pretty straight forward to use a Unix package (panther it's a kind of Unix). If the package is already on CRAN, all you have to do is to search the package (either from the command line or from the menus) and then install. If what you are looking for isn't not on CRAN, but it's available as a *.tgz or tar.gz or as a collection of files, you can use Install from local files in the Packages menu. Good look. PS. Yes, I should be watching soccer (I'm getting my degree at the UNAM), but I decided to sacrifice the first half... After all, the final match will be on Sunday and the meeting with my committee is close, very close... Best regards. On Thu, 10 Jun 2004, Tiago R Magalhaes wrote: Hola ulisses thank you very much for replying to my posting I am using the last Mac Version: OS X 10.3 Panther I use R in the Mac and it works fine The thing is that I want to use a package that was made in UNIX and I wanted to know how easy it would be to run the UNIX version of R in the Mac so that I can use this package for UNIX... shouldn't you be watching soccer? some of my UNAM friends are nuts for a couple of days already! On Thu, 10 Jun 2004, Ulises Mora Alvarez wrote: Hi: Please tell us: which Mac OS are you using? If you are using any of the 10.x, then you should download R-1.9.0 at: http://cran.us.r-project.org/bin/macosx If you have anything older (MacOS 9 or lower), then you should visit: http://cran.us.r-project.org/bin/macos Regards... On Thu, 10 Jun 2004, Tiago R Magalhaes wrote: Hi to you all My question is: there is a package written in UNIX for which there is no Mac version. I would like to know if it's possible to install the R UNIX version on the MacOSX and run that UNIX package on my Mac (through this UNIX R Vresion on a Mac) I have seen a porfile for r version 1.8.1 on darwin: http://r.darwinports.com/ is that it? aother question related to that if it's possible to use UNIX R in Mac, does anyone know how fast or how slow that is? thanks for any help! __ [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 -- Ulises M. Alvarez LAB. DE ONDAS DE CHOQUE FISICA APLICADA Y TECNOLOGIA AVANZADA UNAM [EMAIL PROTECTED] -- Ulises M. Alvarez LAB. DE ONDAS DE CHOQUE FISICA APLICADA Y TECNOLOGIA AVANZADA UNAM [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