similar to: can a matrix of lists work in R?

Displaying 20 results from an estimated 20000 matches similar to: "can a matrix of lists work in R?"

2002 Mar 13
1
several bugs (PR#918) lists and matrices
### I got bit again by the same bugs I wrote about a year ago. ### The bugs are related to matrices and arrays of lists. ### 1. There is a clear inconsistency in how R handles two ### functionally equivalent statements. ### array() is able to take a list and create a matrix. ### matrix() is unable to create that matrix. > vector("list", 2) [[1]] NULL [[2]] NULL >
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
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
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 May 27
0
seek(con, 0, "end", rw="r") does not always work correctly (PR#7901)
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 main/connections.c?] > > > > If you have an idea
2003 Oct 23
3
what's going on here with substitute() ?
I was trying to create a function with a value computed at creation time, using substitute(), but I got results I don't understand: > this.is.R Error: Object "this.is.R" not found > substitute(this.is.R <- function() X, list(X=!is.null(options("CRAN")[[1]]))) this.is.R <- function() TRUE > # the above expression as printed is what I want for the
2005 Apr 15
1
treatment of zero and negative elements in matrix indices
Matrix indexing seems to give rather "variable" results when zeros or negative values are included among the indices (in terms of both error messages and in terms of the number of returned values when there is no error message). Is this the intended behavior? I couldn't see any comments about zeros or negative values in matrix indices in either ?"[" or Section 3.4.2
2004 Aug 17
2
Re: Thanks Frank, setting graph parameters, and why social scientists don't use R
First, many thanks to Frank Harrell for once again helping me out. This actually relates to the next point, which is my contribution to the 'why don't social scientists use R' discussion. I am a hybrid social scientist(child psychiatrist) who trained on SPSS. Many of my difficulties in coming to terms with R have been to do with trying to apply the logic underlying SPSS, with dire
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,
2005 May 26
0
seek(con, 0, "end", rw="r") does not always work correctly (PR#7899)
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 main/connections.c?] If you have an idea where to fflush() precisely and your patch works, please tell it! I'll happily run
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
2005 Dec 13
0
0/1 vector for indexing leads to funny behaviour (PR#8389) (maybe a documentation deficiency?)
The other place its discussed is in 3.4.1 of the R Language Definition: http://finzi.psych.upenn.edu/R/doc/manual/R-lang.html#Indexing-by-vectors On 12/13/05, Tony Plate <tplate at acm.org> wrote: > Yes, 0/1 (numeric) are intended to be used as index vectors -- and they > have the semantics of numeric indices, which is that 0 elements in the > index are omitted from the result.
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 <-
2010 Apr 21
2
suggestion how to use memcpy in duplicate.c
>From copyVector in duplicate.c : void copyVector(SEXP s, SEXP t) { int i, ns, nt; nt = LENGTH(t); ns = LENGTH(s); switch (TYPEOF(s)) { ... case INTSXP: for (i = 0; i < ns; i++) INTEGER(s)[i] = INTEGER(t)[i % nt]; break; ... could that be replaced with : case INTSXP: for (i=0; i<ns/nt; i++) memcpy((char *)DATAPTR(s)+i*nt*sizeof(int),
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
2003 Oct 28
1
proposal for
Having written a number of R programs and having been stung with this myself, I think this is a very good idea. In fact, if the aim of R is to "to do it right" (as one person on the list claimed) rather than be compatible with S-Plus or prior versions of R then I would go even further and make all subscripting behave like this. (If that were to be the way R goes then, of course,
2001 Apr 23
1
several bugs (PR#918)
# Your mailer is set to "none" (default on Windows), # hence we cannot send the bug report directly from R. # Please copy the bug report (after finishing it) to # your favorite email program and send it to # # r-bugs@r-project.org # ###################################################### 1. as.numeric behaves differently in R than in S and I think this shows a bug in how S3
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
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
2007 Jan 18
2
subsetting matrix by subscript=0,x silently skips.
(e-mailing to R-bugs is intentional - the web itnerface seems to be down) > a<- cbind(c(1,2), c(3,4)) > a [,1] [,2] [1,] 1 3 [2,] 2 4 > a[cbind(c(2,2), c(2,1))] [1] 4 2 > a[cbind(c(2,3), c(2,1))] Error: subscript out of bounds > a[cbind(c(2,-1), c(2,1))] Error: negative values are not allowed in a matrix subscript > a[cbind(c(2,0), c(2,1))] [1] 4 Am