Re: [R] mode or parameters of readBin

2007-09-10 Thread Duncan Murdoch
page or the source is a better way to find out about the requirements for the arguments of a function. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] Are the error messages of ConstrOptim() consisten with each other?

2007-09-10 Thread Duncan Murdoch
-orange)^2/(orange^2)) } This is still coded incorrectly. Objective functions optimize over the first parameter only. See ?optim for the details. constrOptim is just a wrapper for optim. Duncan Murdoch fit.error.grr=function(rec1,lambda1,lbar1) {rec=rec1 lambda=lambda1 lbar=lbar1

Re: [R] What does it mean by initial value not available?

2007-09-09 Thread Duncan Murdoch
trying to optimize over them as well. Put them all into one vector. The documentation for constrOptim doesn't make this as clear as it should; I'll clarify (by copying the docs from ?optim). Duncan Murdoch fit.error.grr=function(rec,lambda, lbar) {drec=sum(eval(D(apple,'rec'))*(eval

Re: [R] Sweave figure aspect ratio

2007-09-09 Thread Duncan Murdoch
the one above. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] loop execution problem

2007-09-09 Thread Duncan Murdoch
to save the workplace or not. Please help me out. In Windows you can also abort execution by hitting Esc, or the menu entry Misc|Stop current computation. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] plotting to stdout

2007-09-07 Thread Duncan Murdoch
for the passthrough). The file arg is described as a character string, not a connection, so I wouldn't expect stdout() to work. For write.table(), the arg is defined to be either the name of a file or an open connection. Duncan Murdoch Thanks, --Gene

Re: [R] plotting to stdout

2007-09-07 Thread Duncan Murdoch
not sure all devices guarantee a clean shutdown when R quits. Duncan Murdoch --Gene On Fri, 7 Sep 2007, Duncan Murdoch wrote: On 9/7/2007 12:36 PM, Gene Selkov wrote: I have found two prior instances of this question in R-help, but I can't find the answer, and I'm giving up on mindless

Re: [R] Automatic detachment of dependent packages

2007-09-07 Thread Duncan Murdoch
some sort of snapshot of the state beforehand, and then you could restore it. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

Re: [R] computing distance in miles or km between 2 street addre

2007-09-06 Thread Duncan Murdoch
This includes latitude and longitude. Zip codes cover a fairly large area so this won't give very accurate information, but it's easy to get. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Lisp-like primitives in R

2007-09-06 Thread Duncan Murdoch
://cran.r-project.org/doc/html/interface98-paper/paper.html R was written in C, with the intention that it be Scheme-like. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] For loop with if else statement

2007-09-04 Thread Duncan Murdoch
nor 2.) Duncan Murdoch #Second example: x=c(1,2) t-for(i in 1:length(x)){ if (x==1){ a=x b=x-1}else if (x==2){ a=x+1 b=x} b-list(a=a,b=b) } Returned from R: Warning messages: 1: the condition has

Re: [R] Bugreport on integration of Sweave and latex beamer

2007-08-31 Thread Duncan Murdoch
to do this, but one that works is to use \begin{frame}[containsverbatim] at the start of each slide. This makes some other beamer features stop working, but I forget which. Duncan Murdoch Could you please see the file: http://www.mayin.org/ajayshah/tmp/bugdemo.Rnw Unfortunately

Re: [R] Sweave rendering of simple character

2007-08-31 Thread Duncan Murdoch
, but this probably works anywhere: put keep.source=TRUE in your \SweaveOpts{} at the start of the file. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] Excel

2007-08-30 Thread Duncan Murdoch
this change by manually changing Standard format to Text *every time* I load the file. There's a help index entry date formats;avoiding conversion to, but it offers no more help than add an apostrophe at the beginning of the entry. This is brain-dead behaviour. Duncan Murdoch JWDougherty PS

Re: [R] Behaviour of very large numbers

2007-08-30 Thread Duncan Murdoch
for negative x. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] Excel (off-topic, sort of)

2007-08-30 Thread Duncan Murdoch
for the sample mean and have the data change in response. But just think how much money you could make as a consultant if you could change the p-value from 0.08 to 0.01. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch

Re: [R] Behaviour of very large numbers

2007-08-30 Thread Duncan Murdoch
^(1/3) [1] 0.5+0.8660254i (1/x)^(1/3) [1] 0.5-0.8660254i i.e. even though x and 1/x are equal, the 1/3 powers of them are not. Duncan Murdoch P.S. I'm tempted to say, But don't worry about it, the difference is only imaginary, but I'll refrain. __ R

Re: [R] Excel

2007-08-30 Thread Duncan Murdoch
you should learn astrology? I don't think astrologers have much use for data, but if some did and wanted to hire me to analyze it, I think understanding their point of view would help. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https

Re: [R] Excel

2007-08-29 Thread Duncan Murdoch
figure out what's there you should have access to it from R using getClipboardFormats and readClipboard. I think the only lobbying that would be needed would be to reveal the format, and that may have already been done. Duncan Murdoch __ R-help

Re: [R] FAQ 7.x when 7 does not exist. Useability question

2007-08-27 Thread Duncan Murdoch
On 8/27/2007 8:52 AM, John Kane wrote: --- Duncan Murdoch [EMAIL PROTECTED] wrote: I like the first, simple suggestion best; I'll put it into R-devel. (With the slight change to use ul.menu instead of just ul, because FAQ 2.7 includes a plain ul list.) Duncan Murdoch Thanks Deepayan

Re: [R] oddity with method definition

2007-08-27 Thread Duncan Murdoch
this kind of confusion. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

Re: [R] error message!

2007-08-26 Thread Duncan Murdoch
() update.packages(ask='graphics') Error in .readRDS(pfile) : unknown input format or utils:::menuInstallPkgs() Error in .readRDS(pfile) : unknown input format I'd guess it's a problem with the mirror. Which one did you choose? Do you get the same error if you choose a different one? Duncan Murdoch

Re: [R] How to provide argument when opening RGui from an external application

2007-08-26 Thread Duncan Murdoch
try ?Rscript within R, or Rscript --help from the command line (assuming you have R's bin directory on your path. Duncan Murdoch Prof Brian Ripley a écrit : Look into Rscript.exe (on Windows), which is a flexible way to run scripts. Neither using a GUI nor using source() are recommended

Re: [R] error message!

2007-08-26 Thread Duncan Murdoch
Message From: Duncan Murdoch [EMAIL PROTECTED] To: Usman Shehu [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Sunday, 26 August, 2007 12:02:13 PM Subject: Re: [R] error message! On 26/08/2007 6:13 AM, Usman Shehu wrote: Dear R-users, Can some one help me out. I tried installing

Re: [R] FAQ 7.x when 7 does not exist. Useability question

2007-08-26 Thread Duncan Murdoch
Deepayan Sarkar wrote: On 8/23/07, Duncan Murdoch [EMAIL PROTECTED] wrote: On 8/23/2007 11:28 AM, Prof Brian Ripley wrote: On Thu, 23 Aug 2007, John Kane wrote: The FAQ Section 7 is a very useful place for new users to find out any number of R idiosycracies. However

Re: [R] How is R CMD INSTALL --help executed?

2007-08-26 Thread Duncan Murdoch
. Duncan Murdoch Found example R CMD build --force --binary --auto-zip %1 pkgname in search.R-project.org . What must be done so system can find package pkgname? Bill Morphet ATK Launch Systems, RSRM Postfire Evaluation Eng

Re: [R] It is possible to use a Shell command inside a R script?

2007-08-24 Thread Duncan Murdoch
on the platform, but you want to look at ?system, ?shell, and/or ?shell.exec. (These all exist in Windows; on Unix-alikes, you probably won't have the latter two.) Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman

Re: [R] It is possible to use a Shell command inside a R script?

2007-08-24 Thread Duncan Murdoch
much time. Writing a batch file and then running it was much faster. Since you say batch file I assume you're on Windows. If that's the case, then file.rename() can rename and move a file to a new directory, as long as it's on the same drive. That should be as quick as a batch file. Duncan

Re: [R] It is possible to use a Shell command inside a R script?

2007-08-24 Thread Duncan Murdoch
On 8/24/2007 10:33 AM, Dirk Eddelbuettel wrote: On Fri, Aug 24, 2007 at 08:32:00AM -0400, Duncan Murdoch wrote: On 8/24/2007 6:58 AM, Ronaldo Reis Junior wrote: Hi, It is possible to use a shell command inside a R script? I'm write a R script and I like to put somes shell commands

Re: [R] It is possible to use a Shell command inside a R script?

2007-08-24 Thread Duncan Murdoch
On 8/24/2007 1:05 PM, Gabor Grothendieck wrote: On 8/24/07, Dirk Eddelbuettel [EMAIL PROTECTED] wrote: On Fri, Aug 24, 2007 at 10:57:46AM -0400, Duncan Murdoch wrote: On 8/24/2007 10:33 AM, Dirk Eddelbuettel wrote: On Fri, Aug 24, 2007 at 08:32:00AM -0400, Duncan Murdoch wrote: On 8/24

Re: [R] It is possible to use a Shell command inside a R script?

2007-08-24 Thread Duncan Murdoch
On 8/24/2007 11:14 AM, Dirk Eddelbuettel wrote: On Fri, Aug 24, 2007 at 10:57:46AM -0400, Duncan Murdoch wrote: On 8/24/2007 10:33 AM, Dirk Eddelbuettel wrote: On Fri, Aug 24, 2007 at 08:32:00AM -0400, Duncan Murdoch wrote: On 8/24/2007 6:58 AM, Ronaldo Reis Junior wrote: Hi

Re: [R] FAQ 7.x when 7 does not exist. Useability question

2007-08-23 Thread Duncan Murdoch
--number-sections isn't enough. Duncan Murdoch An R-help list reply of Read FAQ 7.10 in response to a question about converting a factor to numeric is a bit cryptic. The only time 7.10 appears is after the searcher has found the entry. It would help if you told us what you

Re: [R] C code generators

2007-08-22 Thread Duncan Murdoch
. As a matter of fact, one of Oleg's examples is an image filter. Duncan Murdoch (Of course, it can get more complicated than just inserting a single text fragment!) I once implemented such a feature in an image processing package, so I know it's not hard. Before dusting off this ancient code I

Re: [R] Formatting Sweave in R-News

2007-08-22 Thread Duncan Murdoch
On 8/22/2007 3:20 AM, Gregor Gorjanc wrote: Arjun Ravi Narayan contact at arjunnarayan.com writes: I am editing a document for submission to the R-news newsletter, and in my article my Sweave code inserts a dynamically generated PDF report that my R program generates. Slightly off Arjuns

Re: [R] Processing Sweave documents without Sweave

2007-08-22 Thread Duncan Murdoch
not hard to recognize and merge changes to the .tex file back into the Rnw file. Duncan Murdoch Best, Renaud 2007/8/22, Werner Wernersen [EMAIL PROTECTED]: Hi, I am very intrigued by the idea of integrating statistical analysis directly with a paper as Sweave does it. But as I am

Re: [R] Synchronzing workspaces

2007-08-22 Thread Duncan Murdoch
-doing all the simulations in your project. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self

Re: [R] integrate

2007-08-22 Thread Duncan Murdoch
) [1] 1.022467 You can't expect integrate() to return a sensible answer if you don't give it a function that returns consistent results. Duncan Murdoch my.fcn = function(mu){ + m = 1000 + z = 0 + z.mse = 0 + for(i in 1:m){ + z[i] = rnorm(1, mu, 1) + z.mse = z.mse + (z[i] - mu)^2

Re: [R] Variable c and function c

2007-08-21 Thread Duncan Murdoch
be confusing, so it's not a good idea. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

Re: [R] how do i use the get function to obtain an element from a list...

2007-08-21 Thread Duncan Murdoch
(i.e., instead of a$x, it would be a$1, a$2, a$3, and so on, for a million times). i would greatly appreciate it if someone could help me on this issue, Why name things? I'd use something like for (i in 1:100) print(a[[i]]) Duncan Murdoch __ R

Re: [R] library(fCalendar) timeDate(12.03.2005, format=%d.%m.%Y)

2007-08-20 Thread Duncan Murdoch
to the maintainer of the package, in this case Diethelm Wuertz and Rmetrics Core Team [EMAIL PROTECTED]. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] Any parser generator / code assistance for R?

2007-08-20 Thread Duncan Murdoch
for R? I understand that in omegahat.org project, people used ANTLR for RSJava, but i am not sure if that had anything to do with an R-parser. I doubt it. The parser for R is written in yacc/bison, and since nobody has pointed to one based on ANTLR, it probably doesn't exist. Duncan Murdoch

Re: [R] number precision

2007-08-18 Thread Duncan Murdoch
these ranges through transformations. Duncan Murdoch Any thoughts? Pieter -- This message was sent on behalf of [EMAIL PROTECTED] at openSubscriber.com http://www.opensubscriber.com/messages/r-help@stat.math.ethz.ch/topic.html __ R-help

Re: [R] recommended combo of apps for new user?

2007-08-18 Thread Duncan Murdoch
recommend? R is great for this, but you might need to go outside for some specialized stuff (e.g. medical imaging). 3) Any other software I need to learn that would make my work in R more productive? (for example, a code editor). A lot of people are happy with ESS mode in Emacs. Duncan

Re: [R] R graphics display window

2007-08-17 Thread Duncan Murdoch
don't know if any of the devices support programmatic changes from R code, but in Windows you could do most changes by sending Windows messages to the window or doing Windows API calls. You can get the handle using getWindowsHandle(), and then you'll need to write C code to do the work. Duncan

Re: [R] names not inherited in functions

2007-08-17 Thread Duncan Murdoch
. This says to return the expression that was passed to the function if the label() function returned a blank. Duncan Murdoch I just get vars instead of the names when no label is defined : llabel(v1) # works llabel(v2) # gives var instead of v2 Thanks for your help

Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-13 Thread Duncan Murdoch
. An alternative to dropping Preview is to report the bug in it to Apple. Apple has an online bug reporting web page somewhere; I haven't found them as helpful as R-help, but your mileage may vary. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list

Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-13 Thread Duncan Murdoch
, why did it bother you so much? And why do you think it's reasonable to complain about it on R-help, but not to complain about it to Apple, who are clearly responsible for it? Duncan Murdoch On Aug 13, 2007, at 9:30 AM, Duncan Murdoch wrote: On 8/13/2007 11:07 AM, Michael Kubovy wrote

Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-13 Thread Duncan Murdoch
a page full of unhandled bug reports they'll actually do something. Duncan Murdoch On Aug 13, 2007, at 9:56 AM, Duncan Murdoch wrote: On 8/13/2007 11:43 AM, Michael Kubovy wrote: But is it a bug? Can a program anti-alias text and line drawings and not bitmaps? ... [deletions

Re: [R] help with scatterplot3d

2007-08-13 Thread Duncan Murdoch
.3dplot$points3d(x=400, y=600, z=0.19, col=blue, type=h, pch=16) Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-12 Thread Duncan Murdoch
? It looks like a smoothly varying field when produced by R 2.5.1 and viewed in Acrobat Reader 6.0 on Windows. Duncan Murdoch require(grDevices) imSize - 200 lambda - 10 theta - 15 sigma - 40 x - 1:imSize x0 - x / imSize -.5 freq = imSize/lambda xf = x0 * freq * 2 * pi f - function(x, y

Re: [R] How to store the parameter estimated by nls( ) to a variable?

2007-08-12 Thread Duncan Murdoch
for most modelling functions where it makes sense. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented

Re: [R] Artifacts in pdf() of image() (w/o comments)

2007-08-12 Thread Duncan Murdoch
Michael Kubovy wrote: On Aug 12, 2007, at 6:24 AM, Duncan Murdoch wrote: Michael Kubovy wrote: Dear r-helpers, In my previous message there were comments in the code that may have made cutting and pasting awkward. Here it is w/o them. I have two questions: (1) The following

Re: [R] Namespace problem

2007-08-08 Thread Duncan Murdoch
be visible outside your package, but you can still use the ::: notation to get them, e.g. mypackage:::myfunction gets myfunction even if it was not exported. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo

Re: [R] lm( ) for log10-transformed data

2007-08-07 Thread Duncan Murdoch
~ predictor. So you should expect round(ov.mag.min,2) == round(10^(log(res.600nm, 10)*slope.min+intercept.min),2) not the other way around, and this does evaluate to two TRUE values. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https

Re: [R] - round() strange behaviour

2007-08-06 Thread Duncan Murdoch
roundup(). Duncan Murdoch In this context you cannot leave rounding until the end of course! Clearly in an arithmetic context, rounding should always be left to the end but I don't think that is to avoid rounding-to-even but just to avoid unnecessary loss of precision in the calculation. Ask

Re: [R] request

2007-08-04 Thread Duncan Murdoch
the spelling is cumulative, but the help.search() function can find the answer with small misspellings: help.search(commulative sum) yields cumsum as the answer. Duncan Murdoch Thanks Zahid Khan Lecturer in Statistics Department of Mathematics Hazara University Mansehra

Re: [R] How to properly finalize external pointers?

2007-08-03 Thread Duncan Murdoch
in the R-devel group. Duncan Murdoch Best regards Jens Oehlschlägel // C-code static void rindex_finalize(SEXP extPtr){ pINT ptr = R_ExternalPtrAddr(extPtr); if(ptr){ Free(ptr); Rprintf(finalized\n); }else{ Rprintf(nothing to finalize\n); } return

Re: [R] Re : change the names of all listed objects

2007-08-03 Thread Duncan Murdoch
. But if it found a c() function in the global environment, removing it from there might be sensible (maybe even if this rename request were executed from a function, rather than at the top level). Duncan Murdoch ls() [1] a1 Justin BEM BP 1917 Yaoundé Tél (237) 99597295 (237

Re: [R] change the names of all listed objects

2007-08-03 Thread Duncan Murdoch
complicated, because you want to make the assignment in the same place the function found the original. There are quicker ways (using mget() and apply()), but they'd really just be doing the same as the above in a less clear way. Duncan Murdoch __ R

Re: [R] Sourcing commands but delaying their execution

2007-08-03 Thread Duncan Murdoch
the dividing line using divider - which(unlist(lapply(cmds, deparse)) == divider) and then part_one - 1:(divider-1) part_two - (divider+1):length(cmds) Finally, execute as eval(cmds[part_one]) MORE_COMMANDS eval(cmds[part_two]) Duncan Murdoch Andy From: Dennis Fisher

Re: [R] Opening a script with the R editor via file association (on Windows)

2007-08-03 Thread Duncan Murdoch
::file.edit(commandArgs(TRUE)) You could make things more sophisticated if you don't want a blank edit window to open in case you're not using this shortcut. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] Package manual examples - 'unexpected$undefined' errors

2007-07-30 Thread Duncan Murdoch
if the package does have a namespace, you can mask functions from it that you call: for example, if you had a function called zelig (perhaps because you used fix(zelig) to make a small change to the existing one), your line above would call yours, not the original. Duncan Murdoch

Re: [R] plot3d labels

2007-07-20 Thread Duncan Murdoch
might want type=n in the original plot3d call if you don't want the points to interfere with the labels. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] can I paste 'newline'?

2007-07-19 Thread Duncan Murdoch
On 19/07/2007 7:41 PM, runner wrote: It is ok to bury a reg expression '\n' when using 'cat', but not 'paste'. e.g. cat ('I need to move on to a new line', '\n', 'at here') # change line! paste ('I need to move on to a new line', '\n', 'at here') # '\n' is just a character as it is. Is

Re: [R] A simple question

2007-07-17 Thread Duncan Murdoch
the name. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] reading in ! - delimited file

2007-07-17 Thread Duncan Murdoch
in. If you have 3.5 million cases to read, you should specify the column classes. I'd recommend setting nrows to a small number for a few tries first, until you get it right. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch

Re: [R] looking at a function's code

2007-07-16 Thread Duncan Murdoch
? Even though it's not very informative, that really is the source for that function. For instructions on how to see the more useful stuff, see Uwe Ligges' article in the Oct 2006 R News (available at http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf). Duncan Murdoch

Re: [R] Pairlist of pairlsit assembly howto

2007-07-15 Thread Duncan Murdoch
into a subset of length 2, which generates the warnings. You want to assign a list of length 2 as an element of minbins. Duncan Murdoch And it doesn't work ... Warning messages: 1: number of items to replace is not a multiple of replacement length in: minbins[minute] - list(data = a, variable = b) 2

Re: [R] Break during the recursion?

2007-07-15 Thread Duncan Murdoch
and the first index (1), Stack=c(), Indexes=c(). { print(Indexes) # if (sum(i)==0) break # Doesn't work... if (sum(i)==0) return(NULL) should work. Duncan Murdoch if (is.na(v[i])==FALSE is.null(unlist(v[i]))==FALSE) {Stack=c(i,Stack); i=2*i

Re: [R] Break during the recursion?

2007-07-15 Thread Duncan Murdoch
-function(v,i,Stack,Indexes) # input: a vector and the first index (1), Stack=c(), Indexes=c(). { print(Indexes) # if (sum(i)==0) break # Doesn't work... if (sum(i)==0) return(NULL) should work. Duncan Murdoch Hmm - - - I'd like to save the Indexes-vector (in the example c

Re: [R] Break during the recursion?

2007-07-15 Thread Duncan Murdoch
works. It is for inorder-tree- walk. iotw-function(v,i,Stack,Indexes) # input: a vector and the first index (1), Stack=c(), Indexes=c(). { print(Indexes) # if (sum(i)==0) break # Doesn't work... if (sum(i)==0) return(NULL) should work. Duncan Murdoch Hmm - - - I'd like to save

Re: [R] return() in nested functions

2007-07-14 Thread Duncan Murdoch
) return(est1(x,y)) if (type==est2) return(est2(x,y)) because the return() causes the function to exit and return a value. Duncan Murdoch However, without the second 'if' condition, it works properly: Warning message: multi-argument returns are deprecated in: return(x, y, z) test $x [1] 1

Re: [R] eMail results out of R

2007-07-12 Thread Duncan Murdoch
that? This will depend on the system you're using. If the command emailit would work from the command line on your system, then system(emailit) should work from within R. Writing that command is the hard part, of course. Duncan Murdoch __ R-help

Re: [R] sub-function default arguments

2007-07-12 Thread Duncan Murdoch
explicitly manipulate the environment of f2 (which is an ugly way), or you could store nm1 in some place that's visible to both f1 and f2 and use - when you set it from within f1 (another ugly way, but sometimes less ugly than my second suggestion). Duncan Murdoch

Re: [R] 3D plot and interactive PDFs

2007-07-11 Thread Duncan Murdoch
to make it happen, I'd suggest working to add it to the GL2PS project (http://www.geuz.org/gl2ps) and then it should be automatically incorporated into the rgl package. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch

Re: [R] Fraction ECDF

2007-07-10 Thread Duncan Murdoch
, verticals=TRUE, xlim=c(1, max(x)), ylim=c(1-sum(x1)/length(x), 1)) Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

Re: [R] integration over a simplex

2007-07-10 Thread Duncan Murdoch
x[1] x[2] ... x[n] 1, define g - function(x) f(sort(x)), and the integral you want is (1/n!) times the integral of g over the unit cube. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Extracting S code from a C program

2007-07-08 Thread Duncan Murdoch
you have his S code. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

Re: [R] Recursion in R ...

2007-07-07 Thread Duncan Murdoch
version of the sequence. For example, if k=5, n=4, you might draw red 2, 3 and black 1, 2, so you'd build your sequence as 2 3 2 2 3 2 2 2 3 or you might draw red 1, 4, 5 and black 2, so you'd output 1 4 4 5 Duncan Murdoch __ R-help@stat.math.ethz.ch

Re: [R] Me again, about the horrible documentation of tcltk

2007-07-06 Thread Duncan Murdoch
with more than a few entries is just unwieldy. We do have a text reference to the help files in the ?tcltk topic. Duncan Murdoch Cheers, Mike Mike Prager wrote: Alberto Monteiro [EMAIL PROTECTED] wrote: How on Earth can I know what are the arguments of any of the functions

Re: [R] Me again, about the horrible documentation of tcltk

2007-07-06 Thread Duncan Murdoch
=rdoc:tcltk:tkcommands Thanks, Philippe. That's a useful function. Duncan Murdoch Best, Philippe Grosjean ..°})) ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems

Re: [R] .Rprofile: Set package path for downloads

2007-07-06 Thread Duncan Murdoch
, or ?setRepositories. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

Re: [R] Me again, about the horrible documentation of tcltk

2007-07-06 Thread Duncan Murdoch
you can just use the system man pages, as ?tcltk tells you. (And by the way, tkgetOpenFile opens a reasonably nice window for me when run on a Linux system: so this is probably a problem with your local installation of TCL/TK.) Duncan Murdoch __ R

Re: [R] sink() and source()

2007-07-05 Thread Duncan Murdoch
. Listing a variable name on a line by itself only causes it to be printed when you're typing at the console, not when it's a line in a function or a line sourced from a file. You need to call print() explicitly in those cases. Duncan Murdoch __ R

Re: [R] Me again, about the horrible documentation of tcltk

2007-07-05 Thread Duncan Murdoch
you've given reasonable documentation on how to do that. I wish we had a good way to refer to these files from the rest of the help system. Duncan Murdoch Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman

Re: [R] Newbie creating package with compiled code

2007-07-04 Thread Duncan Murdoch
a very strange .First.lib. I think you'll have more success with a simpler one: .First.lib - function(libname, pkgname) library.dynam(mypkg, package=pkgname, lib.loc=libname) (and sss is not needed at all). Duncan Murdoch f - function(x,y) x+y g -function(x,y) x-y Thanks for any

Re: [R] loop causes syntax error in print()

2007-07-03 Thread Duncan Murdoch
of the table. You should simplify your loop until it's something you can post for us to try. Chances are you'll notice the error when you do that, but if not, someone else will be able to tell you what's going on. Without a reproducible example, it's more or less hopeless. Duncan Murdoch

Re: [R] loop causes syntax error in print()

2007-07-03 Thread Duncan Murdoch
On 7/3/2007 10:23 AM, Ivan Baxter wrote: Duncan Murdoch wrote: On 7/3/2007 1:59 AM, Ivan Baxter wrote: I am having trouble printing a table out to the GUI display when the table is created and printed within a loop. I get a Error: syntax error message If I comment out the print

Re: [R] bug in closing gzfile-opened connections?

2007-07-03 Thread Duncan Murdoch
a difference. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] Sweave bug? when writing figures / deleting variable in chunk

2007-06-27 Thread Duncan Murdoch
by it. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] surprising difference in log()

2007-06-26 Thread Duncan Murdoch
.' (emphasis added) floor(3) == 2 True 3 is not greater than 3, but it is greater than 2, so the result you quote above is wrong. You should see floor(3) [1] 3 floor(3) == 2 [1] FALSE Do you really see the result you posted? Duncan Murdoch __ R

Re: [R] a string to enviroment or function

2007-06-25 Thread Duncan Murdoch
that it consider mylab as package instead of its value. One of the examples in ?library shows how to do what you want. pkg - splines library(pkg, character.only = TRUE) Duncan Murdoch Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. P.S. If you think this was helpful, one of the ways

Re: [R] Setting up a blank table with column names in the hard drive

2007-06-24 Thread Duncan Murdoch
when you write subsequent lines). Duncan Murdoch blank - data.frame(name=character(0), wife=character(0), no.children=numeric(0)) write.csv(blank, 'file.csv') Thank you for your help again and your time is highly appreciated! Best Wishes Yuchen Luo I On 6/23/07, Duncan Murdoch

Re: [R] Setting up a blank table with column names in the hard drive

2007-06-23 Thread Duncan Murdoch
the data frame as you calculate new records and rewrite the whole thing, or just append them to the file with append=TRUE and writing with col.names=FALSE. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] what is better when combining data frames? merge vs. rbind cbind

2007-06-22 Thread Duncan Murdoch
. They are much simpler, but much less flexible. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal

Re: [R] Matrix library, CHOLMOD error: problem too large

2007-06-22 Thread Duncan Murdoch
with log1p(tasa) if the authors of the Matrix package have written a method for log1p(); if not, you'll probably have to do it yourself. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] speed issues / pros cons: dataframe vs. matrix

2007-06-22 Thread Duncan Murdoch
: and then I'd consider temporary conversion to a matrix to speed things up. As Knuth said, premature optimization is the root of all evil. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Using the object of character data type as the name of the slot

2007-06-21 Thread Duncan Murdoch
as the slot name contained in chara really is a slot. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented

Re: [R] Adding exponents (superscript format) to a plot

2007-06-21 Thread Duncan Murdoch
On 21/06/2007 7:39 PM, Judith Flores wrote: Hi, I need to add exponents to a label in one of the axes of a plot, how can I do this? See ?plotmath. For example, plot(1,2, xlab=expression(x^2), ylab=expression(exp(-x^2/2))) Duncan Murdoch

Re: [R] non permanent change of vector values

2007-06-20 Thread Duncan Murdoch
- function(x, A) { if (A) x[-1] - 0 else x[-2] - 0 x } then call your function by passing modifyx(x, A) instead of just x. You don't need to put A or x in the argument list of the function, but it probably makes sense to do so. Duncan Murdoch

  1   2   3   4   5   6   7   8   9   10   >