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

2007-09-10 Thread Duncan Murdoch
> lambda=lambda1 > lbar=lbar1 > apple=eval(apple2) > gradient=cbind(eval(D(apple2,'rec')),eval(D(apple2,'lambda')), > eval(D(apple2,'lbar'))) > attr(apple.ana,'gradient')=gradient > apple > } > > fit.error=function(rec1,lambda1

Re: [R] mode or parameters of readBin

2007-09-10 Thread Duncan Murdoch
or, e.g. c(1:2, NA) promotes it to integer, c(3.14, NA) promotes it to numeric.) More generally, I'd say reading the man page or the source is a better way to find out about the requirements for the arguments of a function. Duncan Murdoch __

Re: [R] loop execution problem

2007-09-09 Thread Duncan Murdoch
bort exiting when RGui asks me 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 mailin

Re: [R] Sweave figure aspect ratio

2007-09-09 Thread Duncan Murdoch
o define a macro (e.g. \Gwidth) to give the default width, and then call \setkeys{Gin}{width=\Gwidth} at the start of your document and after any change like 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] What does it mean by "initial value not available"?

2007-09-09 Thread Duncan Murdoch
function optimizes over the elements of the first parameter. You've got two other parameters there, and I think you're 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 clarif

Re: [R] plotting to stdout

2007-09-07 Thread Duncan Murdoch
us) I would include an explicit "dev.off()" after the plotting; I'm 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 h

Re: [R] Automatic detachment of dependent packages

2007-09-07 Thread Duncan Murdoch
.1), RSQLite (>= 0.5-5), gsubfn" >> > > packageDescription does not mention the packages DBI and proto. They are part of the recursive tree-walking that Barry mentioned, i.e. dependencies of RSQLite or gsubfn: > packageDescription("RSQLite", fields="Depends"

Re: [R] plotting to stdout

2007-09-07 Thread Duncan Murdoch
bout the spot in the code where I can fix it. The ?postscript man page suggests that postscript(file="", command="cat") should do what you want (or maybe something other than "cat" for the passthrough). The file arg is described as a character string, not a connect

Re: [R] Lisp-like primitives in R

2007-09-06 Thread Duncan Murdoch
ably correct me). You could also look at Ross Ihaka's paper that is online here: http://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.et

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

2007-09-06 Thread Duncan Murdoch
ne form or another. What were > you proposing to use for this? As far as I know, R has no > database relevant to street addresses! But if the addresses are in the US and include zip codes, a database is available online for free, here: http://www.aggdata.com/files/zip_codes.zip This includes

Re: [R] For loop with if else statement

2007-09-04 Thread Duncan Murdoch
felse( x == 1, x + 1, ifelse( x == 2, x, NA) ) (where I've used NA for the case where x is neither 1 nor 2.) Duncan Murdoch > > #Second example: > x=c(1,2) > t<-for(i in 1:length(x)){ > if (x==1){ > a=x > b=x

Re: [R] Sweave rendering of simple character

2007-08-31 Thread Duncan Murdoch
ut I can't seem to make this work. >> > > I'm not familiar with the Scode environment, but > > > <>= > ?HSP > @ > > > does what you want. > Like Deepayan, I also use <<>>= notation, but this probably works anywhere: put keep.

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

2007-08-31 Thread Duncan Murdoch
there are other ways 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

Re: [R] Excel

2007-08-30 Thread Duncan Murdoch
ople you have to deal with are into astrology 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

Re: [R] Behaviour of very large numbers

2007-08-30 Thread Duncan Murdoch
e+80i > [9] 3.892581e+80-4.389625e+80i 3.136461e+80-3.536955e+80i But watch out if you do this, because of the arbitrary choice of a root. You get oddities like this: > x <- complex(real = -1) > x [1] -1+0i > 1/x [1] -1+0i > x^(1/3) [1] 0.5+0.8660254i > (1/x)^(1/3) [1] 0.5

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

2007-08-30 Thread Duncan Murdoch
tistical calculations are data-reducing, ie, many-to-one. > > I don't think you are likely to find a language where you can change the > confidence limits for the sample mean and have the data change in > response. But just think how much money you could make as a consultant if

Re: [R] Behaviour of very large numbers

2007-08-30 Thread Duncan Murdoch
definition of raising something to a fractional power. The approach R takes to the latter is to define x^B to be exp(B * ln(x)), and ln(x) is undefined for negative x. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailm

Re: [R] Excel

2007-08-30 Thread Duncan Murdoch
lly 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

Re: [R] Excel

2007-08-29 Thread Duncan Murdoch
formats in the Windows clipboard. If you can 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

Re: [R] oddity with method definition

2007-08-27 Thread Duncan Murdoch
. There's a generic called "show" in the methods package. But you can define your own function called "show", and in your workspace, you'd want to call that, not the one from methods. I'd recommend using setGeneric() to create a generic, rather than depend

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 pl

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

2007-08-26 Thread Duncan Murdoch
quired for the system to recognize this command? What you list above should be sufficient. 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

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 v

Re: [R] error message!

2007-08-26 Thread Duncan Murdoch
n me. Duncan > > - Original 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:1

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

2007-08-26 Thread Duncan Murdoch
P > environment. You could 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 >> scri

Re: [R] error message!

2007-08-26 Thread Duncan Murdoch
ose? Do you get the same error if you choose a different one? 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] 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, Ronald

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

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? >> > >

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

2007-08-24 Thread Duncan Murdoch
an 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 Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

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

2007-08-24 Thread Duncan Murdoch
and available functions depend 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 maili

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

2007-08-23 Thread Duncan Murdoch
on't see how to tell makeinfo --html to do this. Adding --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 tim

Re: [R] integrate

2007-08-22 Thread Duncan Murdoch
9786558 > my.fcn(10) [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){

Re: [R] Synchronzing workspaces

2007-08-22 Thread Duncan Murdoch
nction definitions without re-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

Re: [R] Processing Sweave documents without Sweave

2007-08-22 Thread Duncan Murdoch
ode, it's 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 >&

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 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] C code generators

2007-08-22 Thread Duncan Murdoch
roducing > a valid C language routine which can then be compiled by R CMD COMPILE and > dynamically loaded. 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!) > &

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

2007-08-21 Thread Duncan Murdoch
et. > > i intend to do it inside a loop, using a new object (and hence, a new > name) for each iteration (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 iss

Re: [R] Variable c and function c

2007-08-21 Thread Duncan Murdoch
ion, R will ignore variables that are not functions. So what you show above is not an error, though it can 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

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

2007-08-20 Thread Duncan Murdoch
. > > Moreover, my question is still somehow un-answered: Is there any existing > ANTLR-based parser 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 f

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

2007-08-20 Thread Duncan Murdoch
ng value where TRUE/FALSE needed > You should address questions about contributed packages 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 mai

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

2007-08-18 Thread Duncan Murdoch
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 Murdoch __ R-h

Re: [R] number precision

2007-08-18 Thread Duncan Murdoch
. It's then possible (but not easy) to propagate these ranges through transformations. Duncan Murdoch > Any thoughts? > Pieter > > -- > This message was sent on behalf of [EMAIL PROTECTED] at openSubscriber.com > http://www.

Re: [R] names not inherited in functions

2007-08-17 Thread Duncan Murdoch
r) { > if (label(var) !="" ) > res <- label(var) > else res <- names(data.frame(var)) > return (res) } Use "else res <- deparse(substitute(var))" as the 4th line

Re: [R] R graphics display window

2007-08-17 Thread Duncan Murdoch
to write C code to do the work. Duncan Murdoch > Thanks > > Felipe D. Carrillo > Fishery Biologist > US Fish & Wildlife Service > Red Bluff, California 96080 > > __ > R-help@stat.math.ethz.ch mailing list > https:/

Re: [R] help with scatterplot3d

2007-08-13 Thread Duncan Murdoch
", pch=16) > > and got the following error message: > > Error in xyz.coords(x, y, z) : 'x', 'y' and 'z' lengths differ. > > Does anyone know how I can use this function in the scatterplot3d package? try my.3dplot$points3d(x=400, y=600, z=0.19,

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

2007-08-13 Thread Duncan Murdoch
rom them than from us --- but that doesn't mean you shouldn't try. Perhaps when anyone searching for "Mac OSX Preview" on Google shows up a page full of unhandled bug reports they'll actually do something. Duncan Murdoch > > On Aug 13, 2007, at 9:56 AM, Dunca

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

2007-08-13 Thread Duncan Murdoch
x27;t a bug, 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/1

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

2007-08-13 Thread Duncan Murdoch
7;m not yet ready to drop Preview from my toolbox. 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 _

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

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

2007-08-12 Thread Duncan Murdoch
wed up. > > Your help will be highly appreciated! coef(a) will get what you want. coef() works 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-hel

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

2007-08-12 Thread Duncan Murdoch
> What artifacts do you see? 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 > x

Re: [R] Namespace problem

2007-08-08 Thread Duncan Murdoch
you don't export the functions, they won't normally 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-

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

2007-08-07 Thread Duncan Murdoch
in+intercept.min),2) > > round(res.600nm,2) > round(10^(two.points.min*-0.71+1.5),2) The convention in the lm() function is to express a model as response ~ predictor. So you should expect round(ov.mag.min,2) == round(10^(log(res.600nm, 10)*slope.min+intercept.min),2) not the

Re: [R] - round() strange behaviour

2007-08-06 Thread Duncan Murdoch
actually be stored as 0.499 and round(x) should return 0 even using 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

Re: [R] request

2007-08-04 Thread Duncan Murdoch
with above command In English 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 S

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

2007-08-03 Thread Duncan Murdoch
he association as "F:\R\R-2.5.1\bin\Rgui.exe" --args "%1" (with obvious modifications to the path) and put this line in your RHOME/etc/Rprofile.site file: utils::file.edit(commandArgs(TRUE)) You could make things more sophisticated if you don't want a blank edit wind

Re: [R] Sourcing commands but delaying their execution

2007-08-03 Thread Duncan Murdoch
mary(x)) into your file, then cmds <- parse(file="garbage.R", n=NA) as in Andy's suggestion. Then find the dividing line using divider <- which(unlist(lapply(cmds, deparse)) == "divider") and then part_one <- 1:(divider-1) part_two <- (div

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

2007-08-03 Thread Duncan Murdoch
collect(): should it really try to go into the base environment and delete the c object? That would be fairly disastrous if it succeeded. 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

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

2007-08-03 Thread Duncan Murdoch
ewname, get(oldname)) # delete the old object rm(list=oldname) } The code above should work in simple cases where you run it in the console and it works on objects in the global workspace. If you want to write a function to do this things get more complicated, because you want to make

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

2007-08-03 Thread Duncan Murdoch
do nothing when you see the null ptr, as you do below? By the way, questions about programming at this level are better asked in the R-devel group. Duncan Murdoch > Best regards > > > Jens Oehlschlägel > > > // C-code > > static void rindex_finalize(SEXP extPtr){ >

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

2007-07-30 Thread Duncan Murdoch
lig (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 __ 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] plot3d labels

2007-07-20 Thread Duncan Murdoch
and than tried to implement this in the text3d: > > text3d( c(Anth_cap, > Anth_crin, I think all you need is text3d(PCoA, text=Nam) but you might want to set the adj argument if you want the labels offset from the points, and you might want type="n" in the original plot3

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. >

Re: [R] reading in "!" - delimited file

2007-07-17 Thread Duncan Murdoch
t just because I > have 3.5 million cases to read 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 _

Re: [R] A simple question

2007-07-17 Thread Duncan Murdoch
vector with a named entry. You can do calculations with it without stripping off 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.

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

2007-07-16 Thread Duncan Murdoch
lines of R code. Any suggestions? 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.

Re: [R] Break during the recursion?

2007-07-15 Thread Duncan Murdoch
# 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) >>>> >>>

Re: [R] Break during the recursion?

2007-07-15 Thread Duncan Murdoch
) >> >>> Here is a function which almost 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)

Re: [R] Break during the recursion?

2007-07-15 Thread Duncan Murdoch
tack,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 > > if (is.na(v[i])==FALSE & is.

Re: [R] Pairlist of pairlsit assembly howto

2007-07-15 Thread Duncan Murdoch
he element, the latter works on a subset. So your version tried to change a subset of length 1 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:

Re: [R] return() in nested functions

2007-07-14 Thread Duncan Murdoch
t of the second if is NULL. That's what your function returned. If you had wrapped those calls in return() you'd get what I think you expected: if (type=="est1") return(est1(x,y)) if (type=="est2") return(est2(x,y)) because the return() causes the function to ex

Re: [R] sub-function default arguments

2007-07-12 Thread Duncan Murdoch
hin f1, e.g. f1<-function(...){ nm1 <- something f2 <- function (...) {} result1<-f2(nmArg1=nm1) ... } (which is the best way to do it), or you could explicitly manipulate the environment of f2 (which is an ugly way), or you could store nm1 in some place that's visib

Re: [R] eMail results out of R

2007-07-12 Thread Duncan Murdoch
other person. How can I do 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

Re: [R] 3D plot and interactive PDFs

2007-07-11 Thread Duncan Murdoch
you want to help 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 htt

Re: [R] integration over a simplex

2007-07-10 Thread Duncan Murdoch
n! copies of it onto a cube, and use adapt to integrate over that. That is: if f() is your function, defined on 0 < 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

Re: [R] Fraction ECDF

2007-07-10 Thread Duncan Murdoch
m arguments to plot() to change the range. For example, plot(ecdf(x), do.points=FALSE, verticals=TRUE, xlim=c(1, max(x)), ylim=c(1-sum(x>1)/length(x), 1)) Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo

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

2007-07-08 Thread Duncan Murdoch
contacting Dr. DuMouchel to see if he is willing to let 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

Re: [R] Recursion in R ...

2007-07-07 Thread Duncan Murdoch
er. Proceeding from smallest to largest, if you see a black i, duplicate the i'th element in the current 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 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] Me again, about the horrible documentation of tcltk

2007-07-06 Thread Duncan Murdoch
#x27;s why I wanted to know if there was a way to > improve the function call - I think there isn't. But on Linux 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

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

2007-07-06 Thread Duncan Murdoch
is? See the repos option in ?options, 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 commen

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

2007-07-06 Thread Duncan Murdoch
/doku.php?id=rdoc:tcltk:tkcommands Thanks, Philippe. That's a useful function. Duncan Murdoch > Best, > > Philippe Grosjean > > ..<°}))>< > ) ) ) ) ) > ( ( ( ( (Prof. Philippe Grosjean > ) ) ) ) ) &

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

2007-07-06 Thread Duncan Murdoch
his, but a GUI menu 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: >> >>

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

2007-07-05 Thread Duncan Murdoch
ndows (assuming Mac OSX counts as an *ix), and TCL and TK help files are distributed with R. See RHOME/Tcl/doc. He'll still have the problem of converting TCL/TK documentation conventions into their R equivalents, but I think you've given reasonable documentation on how to do t

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

2007-07-05 Thread Duncan Murdoch
ks You don't say what is going wrong, but I suspect your problem is that you're not printing matrix.merge2. 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

Re: [R] Newbie creating package with compiled code

2007-07-04 Thread Duncan Murdoch
failed for 'mypkg' > Execution halted > > It looks like this package has a loading problem: see the messages for > details. > > Here is the mypkg.R file > sss <- "/home/hodgesse/Desktop/R-2.5.1" > .First.lib <- function(lib=sss,pkg="mypkg") >

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

2007-07-03 Thread Duncan Murdoch
I create a gzipped version of a write.table output and run for(i in 1:1000) read.table(gzfile(f)) in R 2.5.0 I don't see a problem. This is on Windows, but I doubt that makes a difference. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing lis

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

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

2007-07-03 Thread Duncan Murdoch
I can print > out the last iteration 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 reproducibl

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

2007-06-27 Thread Duncan Murdoch
s well known by people who've been bitten 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

Re: [R] surprising difference in log()

2007-06-26 Thread Duncan Murdoch
ng > elements of x.' (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 rea

Re: [R] a string to enviroment or function

2007-06-25 Thread Duncan Murdoch
s parameter, it still > complains about "mylab" does not exist. It seems 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 >

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

2007-06-24 Thread Duncan Murdoch
you don't want it, specify row.names=FALSE (and do the same 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

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

2007-06-23 Thread Duncan Murdoch
esults, so write.csv will work. Create a data frame with 0 rows, and write it out: this will give you your header line. e.g. blank <- data.frame(name=character(0), wife=character(0), no.children=numeric(0)) write.csv(blank, 'file.csv') Now you can rbind new lines onto the

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

2007-06-22 Thread Duncan Murdoch
columns are characteristics, until I found they were too slow: 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

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

2007-06-22 Thread Duncan Murdoch
se, so that's likely your problem. You might have better luck 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

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

2007-06-22 Thread Duncan Murdoch
ar pros and cons of each approach? If rbind or cbind work, use them. 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 gui

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))) Du

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

2007-06-21 Thread Duncan Murdoch
like to know how could I utilize the object chara , and to > use the characters it contains as the name of the slot of try1. You can use slot(try1, chara) <- matrix("", 3, 4) as long as the slot name contained in chara really is a slot. Duncan Murdoch

Re: [R] non permanent change of vector values

2007-06-20 Thread Duncan Murdoch
> (that is because condition 'A' might be called again and could be different > in > it's T/F state from previous calls). Simply make a function that does what you want: modifyx <- function(x, A) { if (A) x[-1] <- 0 else x[-2] <- 0 x } then call

  1   2   3   4   5   6   7   8   9   10   >