[R] system(R CMD BATCH ...) on UNIX-alikes
If I start from R (in emacs) a new R batch job using system(R CMD BATCH --no-save --quiet Rin.txt Rout.txt, intern=FALSE, ignore.stderr=TRUE, wait=FALSE, input=NULL) the job runs fine and smooth. However, when, for any reason, I press later ctrl+C in the calling R, it not only kills the loop or whatever in the emacs/R, but it kills me the called batch job, too. Why? Can I avoid that? Best regards Meinhard PS system : MacOS 10.4.9 Intel, R 2.5.0 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] system() and R BATCH
If I start from within R a new R batch job by using something like system(R CMD BATCH --no-save --quiet Rin.txt Rout.txt, intern=FALSE, ignore.stderr=TRUE, wait=FALSE, input=NULL) the job runs fine and smooth. However, when, for any reason, I put twice ctrl+C in the calling R, it kills me the called batch job, too. This is not what I wanted. Ctrl +C is usually rather used to stop a loop etc. Why it stops the called batch jobs, too? What can be the solution for me - avoiding the called batch jobs to be killable from the calling R process? Best regards Meinhard PS system: MacOS 10.4.9 Intel, R 2.5.0 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] where is the source code of bca.ci?
i was searching for the source of bca.ci, a function of the package boot. I tried require(boot, keep.source=TRUE) but again the source was not viewable. How should i do? Best regards Meinhard Ploner PS version _ platform i386-apple-darwin8.8.1 arch i386 os darwin8.8.1 system i386, darwin8.8.1 status major 2 minor 4.0 year 2006 month 10 day03 svn rev39566 language R version.string R version 2.4.0 (2006-10-03) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] where is the source code of bca.ci?
Chuck and Marc, thanks for the good answers! MP On Dec 21, 2006, at 2:48 PM, Chuck Cleland wrote: Meinhard Ploner wrote: i was searching for the source of bca.ci, a function of the package boot. I tried require(boot, keep.source=TRUE) but again the source was not viewable. How should i do? If you download the source package (http://cran.at.r-project.org/src/contrib/boot_1.2-27.tar.gz) and unpack the compressed archive, you will see the bca.ci function in the file called bootfuns.q . Best regards Meinhard Ploner PS version _ platform i386-apple-darwin8.8.1 arch i386 os darwin8.8.1 system i386, darwin8.8.1 status major 2 minor 4.0 year 2006 month 10 day03 svn rev39566 language R version.string R version 2.4.0 (2006-10-03) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] (not so real) function (more like #include)
Thanks a lot! longfun2 longfun3 work perfect for my very untypical problem. As I have many local variables, usual functions with parameters are very uncomfortable, but the code you gave me is great! Meinhard On Oct 4, 2006, at 5:25 PM, Gabor Grothendieck wrote: longfun could just pass a, b and d to each of the individual functions and each of the individual functions could pass out back as a return value. f1 - f2 - function(a, b, d) a+b+d longfun1 - function() { a - b - d - 1 out - f1(a, b, d) out - f2(a, b, d) + out out } longfun1() # 6 If the problem is that a, b and d actually represent 100 variables, say, and its a nuisance to pass them all explicitly you could do this: f1 - f2 - function() with(parent.frame(), a + b + d) longfun2 - function() { a - b - d - 1 out - f1() out - f2() + out out } longfun2() # 6 or you could do it this way if you would prefer to have longfun control the scoping rather than having it done within each individual function: f1 - f2 - function() a+b+d longfun3 - function() { a - b - d - 1 environment(f1) - environment(f2) - environment() out - f1() f2() + out } longfun3() # 6 On 10/4/06, Meinhard Ploner [EMAIL PROTECTED] wrote: Hello R users, I have a very long function with parts of that looking like a list of jobs. The first part of the function defines a lot of local variables, which are used by the jobs. Now I extracted the job part und putted them into an external file, used by source(, local=T), which is more comfortable to me. Apart from that it gives me the opportunity that more users can work on the project. Is it possible to define a function for that code and passing to it the environment of f() without save(list=ls()) and load() ? Thanks in advance Meinhard Ploner longfun - f() { ## lot of local variables: a - ... b - ... d - ... ... out - ... source(job1.txt, local=TRUE) #changes out, uses a, b, d, ... source(job2.txt, local=TRUE) # changes out, uses a, b, d, ... ... } version _ platform i386-apple-darwin8.6.1 arch i386 os darwin8.6.1 system i386, darwin8.6.1 status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] (not so real) function (more like #include)
Hello R users, I have a very long function with parts of that looking like a list of jobs. The first part of the function defines a lot of local variables, which are used by the jobs. Now I extracted the job part und putted them into an external file, used by source(, local=T), which is more comfortable to me. Apart from that it gives me the opportunity that more users can work on the project. Is it possible to define a function for that code and passing to it the environment of f() without save(list=ls()) and load() ? Thanks in advance Meinhard Ploner longfun - f() { ## lot of local variables: a - ... b - ... d - ... ... out - ... source(job1.txt, local=TRUE) #changes out, uses a, b, d, ... source(job2.txt, local=TRUE) # changes out, uses a, b, d, ... ... } version _ platform i386-apple-darwin8.6.1 arch i386 os darwin8.6.1 system i386, darwin8.6.1 status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] problem with Rcmd check and fortran95, makefile
Hi all, I have Win XP and R 2.3.1 on my notebook. I would like to write a package which includes some Fortran 95 code. Interestingly, if I compile and link the simple file test90.f90 directly with g95 -c test90.f90 g95 -shared -o test90.dll test90.o then PE Viewer ( a dll viewer) shows me the right functions in the export table, hence I can use the dll in R. But as it should become part of a package I wrote the simple src/Makefile F95=g95 prog: test90.f90 $(F95) -shared -o test90.dll test90.o test90.f90: test90.f90 $(F95) -c test90.f90 which looks totally equal to the 2 commands above. If I run now Rcmd check --no-latex test90 Rcmd install test90 then test90.dll is made but the export table is empty and therefore in R the functions cannot be loaded. Any idea? Can it be that Rcmd gives further flags to the compiler/linker? Any hints appreciated Meinhard Ploner South Tyrol (Italy) PS The fortran file is simply: SUBROUTINE BLABLA(A) !DEC$ ATTRIBUTES DLLEXPORT :: blabla### without this line the prob is the same :-( IMPLICIT DOUBLE PRECISION (A-H,O-Z) A=A+1 RETURN END SUBROUTINE BLABLA [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] need help in building an R package with Fortran source
Hello all! Can someone give me instructions how to build on PC/Win an R package with some embedded Fortran functions (preferable source, not dll!). The package should then be compilable and work on PC/Win as well as on Unix derivatives. Thanks a lot Meinhard Ploner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] need help in building an R package with Fortran source
Uwe recommended the reading of help desk in Rnews 2005/2 http://cran.r-project.org/doc/Rnews/Rnews_2005-2.pdf Thanks, it looks good, as my problems were mainly due to Perl and some compilers!! Meinhard __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] export from R to MySQL
On Dec 12, 2005, at 6:50 PM, David James wrote: Prof Brian Ripley wrote: On Mon, 12 Dec 2005, Sean Davis wrote: On 12/12/05 9:21 AM, bogdan romocea [EMAIL PROTECTED] wrote: Sean Davis wrote: but you will have to create the table by hand There's no need for manual steps. To take advantage of MySQL's extremely fast 'load data infile' you could dump the data in CSV format, write a script for mysql (the command line tool), for example q - function(table,infile) { query - paste( create table ,table, (col1 float, col2 float); This is creating the table by hand, as opposed to using dbWriteTable. If your data.frame contains 67 columns, using dbWriteTable saves quite a bit of typing The RODBC equivalent creates the table for you, then fast imports the file. Might be worthwhile contribution to RMySQL for someone. That's what RMySQL's dbWriteTable() does. The original posting mentioned problems associated with speed of data.frame and dbWriteTable, which seems plausible (but I haven't quantified it myself) given the fact that dbWriteTable outputs a data.frame to an intermediate file via write.table and then uses the LOAD DATA for fast loading that intermediate file. Thanks at all! As write.table and read.table itself are to some degree slow, for matrizes which are only numeric cat() and scan() could be faster. however it's a special case. Just be careful with client-server systems to have the file in the right place (if indeed you are allowed to have files on the server). -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- David __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] export from R to MySQL
Hi R user! What is the fastest way to export a large matrix or vector to a MySQL database? The use of data.frame() and dbWriteTable() makes the process slow, so is there any direct alternative? Regards Meinhard Ploner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] strange behaviour of memory management
Hi all! My system: R 2.1.1, Mac OS X 10.4.2. I have a very memory-consuming job for R, consisting of a function calling some other functions, working often with matrices of size 100.000 x 300. If I call the job directly after starting R the job takes overall 40min, however only 7min of process time. I assume the large difference is through memory-handling which doesn't count as process time. If i start the job after I make some shorter runs, some programming, then the job stops by reaching a memory limit. It seems that R doesn't release all the memory even if it don't adds global objects. Further I'm interesited if for a UNIX-derivate like Mac OS X gc() or rm(localObjects) (used in local functions) make any difference/ advantage?? Best Meinhard Ploner Erste Bank __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] emacs, Mac OS X, R
Hi! Since August I am using emacs on my Macintosh to edit the R objects. I have installed R 1.9.1, Mac OS X 10.3.5 and GNU Emacs 21.2.1. However there are some issues I haven't resolved: a) switch the caps lock key to the meta key (and when this is not possible, switch the alt/option key to the meta). The switch should work only within emacs! b) having different colors for the code, i.e. comments, commands, strings, ... thanks in advance! Meinhard __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] list of S3-methods
how can I get a list of all S3-methods (of a package) such that I know which functions to include in the S3method() in the NAMESPACE-file? Maybe separated by generic=T/F. thx Meinhard Ploner Vienna __ [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] list of S3-methods
Meinhard Ploner wrote: how can I get a list of all S3-methods (of a package) such that I know which functions to include in the S3method() in the NAMESPACE-file? Maybe separated by generic=T/F. thx Meinhard Ploner Vienna Since one you does not register S3 methods (except for the Namespace file), you cannot get such a list very easily. You might want to look for function names with a dot in it and then look whether the second part of that name corresponds to a class. Uwe Ligges Thank you. Usually users register S3-methods prior to make libraries or is this possible only for S4 classes? Meinhard Ploner __ [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] packages data-sets name spaces
From: Prof Brian Ripley [EMAIL PROTECTED] Date: June 17, 2004 12:15:01 PM CEST To: Meinhard Ploner [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [R] packages data-sets On Thu, 17 Jun 2004, Meinhard Ploner wrote: It's possible to create a package with functions and data, from which the use library(pkg-name) attaches not only the functions, but also the data? I want avoid to use data(dataset, package=name) because this makes a global copy of the data-set ... What do you mean by `global'? You cannot have access to R data without having it in memory and having it visible. You don't need to have it in the user workspace (.GlobalEnv), though. Suggestions: 1) See how MASS does it. Data objects are loaded into the MASS namespace on first use. After some playing-around I found that I forgot to insert in NAMESPACE export(package.load.data) which I defined as you in MASS/R (MASS.load.data). Now all works fine and I'm very happy about this solution! Thanks a lot! Meinhard Ploner 2) See ?attach and attach an R save file containing your datasets -- wasteful unless you use them all at once. It is planned that data() will be superseded by a better mechanism in R 2.0.0 (but that plan has slipped a bit already, which is why MASS does it differently). -- 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] building packages with NAMESPACE
hi! I tried to build a very simple package with NAMESPACE file, such that datasets are loaded only dynamically. a2 - function(x=a1) x+4 a1 - 1:10 package.skeleton(aaa, list=c(a1, a2)) Then I modified the help files and added the file NAMESPACE with these 2 lines: useDynLib(aaa) export(a1, a2) Then R CMD BUILD aaa works fine, but R CMD CHECK aaa gives: . * checking R files for syntax errors ... OK * checking R files for library.dynam ... OK * checking S3 generic/method consistency ... WARNING Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE) : package/namespace load failed Execution halted * checking for replacement functions with final arg not named 'value' ... WARNING Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE) : package/namespace load failed Execution halted Without NAMESPACE file there wasn't any error, so anybody could help me? Thanks Meinhard Ploner PS: version _ platform powerpc-apple-darwin7.2.0 arch powerpc os darwin7.2.0 system powerpc, darwin7.2.0 status major1 minor8.1 year 2003 month11 day 21 language R __ [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] packages data-sets
It's possible to create a package with functions and data, from which the use library(pkg-name) attaches not only the functions, but also the data? I want avoid to use data(dataset, package=name) because this makes a global copy of the data-set ... Anyone could help me? Meinhard __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to modify variables of another frame (but not global)
Hello! Maybe frame is not the right term in this context. I explain my problem by example code: fun2 - function(objName, add) { ## the object objName should be increased by add, ## but the evaluation should be done in the calling function (here: fun1) ##.. what's the right code?? } fun1 - function() { x - 1 fun2(x, 10) ## should modify x ## now x should be 11, but only here and NOT globally! ... } I would like to appreciate any solution! Thanks in advance Meinhard Ploner __ [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] Problem with data.frame and attach
Hi, I just encountered a problem in R that may easily be fixed: If one uses attach for a data.frame e.g. 1 times and forgets detach, then R gets incredibly slow (less then 10% of the original speed). My system: platform powerpc-apple-darwin6.0 arch powerpc os darwin6.0 system powerpc, darwin6.0 status major1 minor6.1 year 2002 month11 day 01 language R Kind regards, Andreas Eckner __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] solve lagrange
Hi! Anyone can help me solving a Lagrangian function in R? Should I use deriv and then optim by including the further conditions or is there an other way? Thanks Meinhard __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help