Displaying 3 results from an estimated 3 matches for "indlist".
Did you mean:
in_list
2006 Oct 19
2
arraytake for extracting subarrays from multidimensional arrays
...8 10 12
> arraytake(a,list(NULL,1:3,c(4,2))) ##This invocation does not, and
produces the same result
, , 1
[,1] [,2] [,3]
[1,] 19 21 23
[2,] 20 22 24
, , 2
[,1] [,2] [,3]
[1,] 7 9 11
[2,] 8 10 12
Code below:
--------
arraytake <- function(x,indlist) {
#Returns subarrays of arbitrary dimensioned arrays
#1) Let x be a multidimensional array with an arbitrary number of
dimensions.
#2) Let indlist be a list of vectors. The length of indlist is the same as
the number of
#dimensions in x. Each element of the indlist is a vector which speci...
2009 Sep 11
2
Accumulating results from "for" loop in a list/array
Dear R users,
I would like to accumulate objects generated from 'for' loop to a list or
array.
To illustrate the problem, arbitrary data set and script is shown below,
x <- data.frame(a = c(rep("n",3),rep("y",2),rep("n",3),rep("y",2)), b =
c(rep("y",2),rep("n",4),rep("y",3),"n"), c =
2009 Sep 11
3
For sending my R package as part of R-project
...ay
To: Steven Kang <stochastickang at gmail.com>
Cc: r-help at r-project.org
Message-ID:
<39226c970909102349s58550d34k22cac2987742e182 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Steven
I think list() can help you
##########################################
indlist = list()
for (i in 1:(dim(x)[2])) {
indlist[[paste("ind", i, sep = "")]] <- which(x[ , i] == "y")
}
accum = unlist(indlist)
print(indlist$ind1)
###########################################
Schalk Heunis
On Fri, Sep 11, 2009 at 7:52 AM, Steven Kang &l...