similar to: what's going on here with substitute() ?

Displaying 20 results from an estimated 20000 matches similar to: "what's going on here with substitute() ?"

2004 Mar 18
12
substitute question
Consider the following example: # substitute a with b in the indicated function. Seems to work. > z <- substitute( function()a+1, list(a=quote(b)) ) > z function() b + 1 # z is an object of class call so use eval # to turn it into an object of class expression; however, # when z is evaluated, the variable a returns. > eval(z) function()a+1 Why did a suddenly reappear again
2004 Jan 14
2
automatic "paste" filter to paste only the commands from a transcript on the clipboard
Just for fun (and actually because I would use it too) I wrote a version of the "paste" menu command that assumes the clipboard contains a transcript, and just pastes the commands from it into the R console window (Windows GUI only). So, if something like this: > foo <- + 33 > foo * 3 [1] 99 > foo [1] 33 is on the clipboard, then the "paste commands" menu
2005 Jun 09
1
single assignment affecting multiple sub-structures (PR#7924)
I'm trying to create a language structure that is a call to a function with a number of arguments that is only known at run time. I do this by using repeated indices to expand out a call with a single argument. However, when I change one of the arguments, all are changed. I don't see the same behavior when I initially create a call with multiple arguments. Even more strangely,
2003 Oct 21
5
do.call() and aperm()
Hi everyone I've been playing with do.call() but I'm having problems understanding it. I have a list of "n" elements, each one of which is "d" dimensional [actually an n-by-n-by ... by-n array]. Neither n nor d is known in advance. I want to bind the elements together in a higher-dimensional array. Toy example follows with d=n=3. f <-
2002 Oct 10
2
tapply for matrices
Does anyone have something like tapply that is extremely fast for matrices when there is a very large number of levels of the grouping variable? I'm referring to, for example, tapply(x, grouping.variable, function.operating.on.submatrix) where x is a matrix and the submatrix is a subset of the rows of x. The grouping variable's length equals the number of rows of x. -- Frank E
2004 Sep 24
1
algorithm reference for sample() - Knuth
Thank you for the reference to Knuth. Indeed in vol. 2 he has a > -----Original Message----- > From: Tony Plate [mailto:tplate@blackmesacapital.com] > Sent: Friday, September 24, 2004 8:05 AM > To: Vadim Ogranovich > Subject: Re: [Rd] algorithm reference for sample() > > Have you tried looking in Knuth's books on computer > algorithms? (They are classics for good
2003 Sep 17
1
Just don't do it, surely? (was RE: Retrieve ... argument values)
Tony, I don't understand what you mean. Could you give an example? > -----Original Message----- > From: Tony Plate [mailto:tplate at blackmesacapital.com] > > ... I'm not saying "never write functions that use ...", > >I'm just saying "never write functions that depend on a particular > >argument being passed via ...". > > Several
2004 Mar 31
3
Maximum number of connections in R
It appears that the maximum number of connections available in R is about 48. Can anyone tell me how to bump this number up? I've been perusing the source, but any info would speed things up. Is there a reason that it was set to such a low number? Thanks for any help. -Frank
2003 Oct 31
4
Array Dimension Names
I would like to reference array dimensions by name in an apply and a summary function. For example: apply(x, "workers", sum) Is there a better way to do this than creating a new attribute for the array and then creating new methods for apply and summary? I don't want to name the individual elements of each dimension (such as with dimnames) but rather name the dimensions. Thanks
2003 Oct 08
6
Why does a[which(b == c[d])] not work?
Dear list, I can not understand why the expression in the subject does not work correct: > dcrn[which(fn == inve[2])] numeric(0) > inve[2] [1] 406.7 > dcrn[which(fn == 406.7)] [1] 1.3994e-07 1.3988e-07 1.3953e-07 1.3966e-07 1.3953e-07 1.3968e-07 Is this a kick self problem or an bug? Thaks very much Thomas
2004 Mar 17
3
unit testing framework for R?
In a quick search of the R website just now, I found no mention of a unit testing framework for R. I hope to find something in the style of Java's JUnit, or Python's unittest. Is such a thing available? Thanks, - Paul Shannon Institute for Systems Biology Seattle
2004 Mar 10
5
do.call and environments
Hello, I want to call a function "fx" given by name, where some "global" variables (in the environment of fx) are passed to the function. For compatibility reasons I cannot modify the parameter list of fx and I want to avoid setting variables in the global environment (e.g. via <<-) Is there a way, how to do this? Thomas P. The example: fx <- function(y)
2005 May 28
1
(PR#7899) seek(con, 0, "end", rw="r") does not always work
Tony Plate wrote: > ligges@statistik.uni-dortmund.de wrote: > >> tplate@blackmesacapital.com wrote: >> >> >>> I've noticed that seek(con, 0, "end", rw="r") on a file connection >>> does not always work correctly after a write (R 2.1.0 on Windows). >>> >>> [Is a call to fflush() needed inside file_seek() in
2005 Feb 22
1
bug? quantile() can return decreasing sample quantiles for increasing probabilities
Is it a bug that quantile() can return a lower sample quantile for a higher probability? > ##### quantile returns decreasing results with increasing probs (data at the end of the message) > quantile(x2, (0:5)/5) 0% 20% 40% 60% 80% -0.0014141174 -0.0009041968 -0.0009041968 -0.0007315023 -0.0005746115 100% 0.2905596324 >
2003 Oct 17
7
datetime data and plotting
If I take the following simple data: YEAR MONTH DAY WEIGHT.KG 2003 10 6 1.2 2003 10 12 1.2 2003 10 16 1.3 and format the date data and plot it: dates <- strptime(paste(DAY,MONTH,YEAR),"%d%m%Y") plot(c(min(dates),max(dates)),c(0,max(WEIGHT.KG)), xlab="Date",ylab="Weight (kg)",type="n") lines(dates,WEIGHT.KG) points(dates,WEIGHT.KG) I find that the
2010 Mar 22
2
problems extracting parts of a summary object
summary(x), where x is the output of lm, produces the expectedd display, including standard errors of the coefficients. summary(x)$coefficients produces a vector (x is r$individual[[2]]): > r$individual[[2]]$coefficients tX(Intercept) tXcigspmkr tXpeld tXsmkpreve mn -2.449188e+04 -4.143249e+00 4.707007e+04 -3.112334e+01 1.671106e-01 mncigspmkr mnpeld
2006 Aug 03
4
meta characters in file path
Hi, I need to read in some files. The file names contain come meta characters such as @, #, and white spaces etc, In read.csv, file= option, is there any way that one can make the function to recognize a file path with those characters? Thanks Johnny [[alternative HTML version deleted]]
2005 May 19
1
problems with truncate() with files > 2Gb under Windows (possibly (PR#7879)
This message relates to handling files > 2Gb under Windows. (I use 2Gb as shorthand for 2^31-1 -- the largest integer representable in a signed 32 bit integer.) First issue: truncate() is not able to successfully truncate files at a position > 2Gb. This appears to be due to the use of the Windows function chsize() in file_truncate() in main/connections.c (chsize() takes a long int
2004 Jun 07
2
strange apparently data-dependent crash with large data (PR#6955)
I'm consistently seeing R crash with a particular large data set. What's strange is that although the crash seems related to running out of memory, I'm unable to construct a pseudo-random data set of the same size that also causes the crash. Further adding to the strangeness is that the crash only happens if the dataset goes through a save()/load() cycle -- without that, the
2005 Apr 22
2
pointer to comments re Paul Murrell's new book, R, & SAS on Andrew Gelman's blog
There are some interesting comments re Paul Murrell's new book, R, & SAS on Andrew Gelman's blog: http://www.stat.columbia.edu/~cook/movabletype/archives/2005/04/a_new_book_on_r.html -- Tony Plate