Displaying 20 results from an estimated 300 matches similar to: "arraytake for extracting subarrays from multidimensional arrays"
2005 Apr 29
2
Subarrays
Define an array
> v<-1:256
> dim(v)<-rep(4,4)
Subarrays can be obtained as follows:
> v[3,2,,2]
[1] 71 87 103 119
> v[3,,,2]
[,1] [,2] [,3] [,4]
[1,] 67 83 99 115
[2,] 71 87 103 119
[3,] 75 91 107 123
[4,] 79 95 111 127
In the general case this procedure is very tedious.
Given an array
A, dim(A)=(dim_1,dim_2,...,dim_d)
and two vectors
2010 Dec 16
1
Subarray specification problem
Hi. I'm new to R, and I'm still learning R's system for addressing
subsets of data structures. I'm particularly interested in the
problem of selecting subarrays based on complex criteria involving the
dimnames (as opposed to the values of the cells) of the array. Here's
an example of such a problem.
Suppose I have an array x of unknown dimensions (it may have been
passed as
2010 Mar 18
2
how to take multiple subsets from a matrix
useR's
I have a matrix from which I want to take multiple subsets from, according
to a particular scheme I will now describe. The matrix below (mat) is 5x5,
and I want to take 9 subsets of it, each of dimension 3x3. The best way to
explain what the result should look like is with the following:
> dat <- c(3,6,1,9,12,9,2,10,6,5,3,13,1,4,8,9,4,6,10,11,2,7,3,5,10)
> miss <-
2004 Aug 23
3
idea for "virtual matrix/array" class
I've been wondering how to work with more data than can fit in memory, in a
way that allows it to be worked with conveniently and quickly. Of course,
a database can be used for this purpose, but extracting data from a
database is much slower and somewhat less convenient than extracting data
from a native object (at least in our setup).
One idea I was thinking about was to have a new
2010 Mar 16
2
Help running a Fortran subroutine from R
useR's,
I need help getting a Fortran DLL successfully returning the correct output.
The attached fortran source code (filter2d.f) and DLL (filter2d.dll) are
attached. Also, I attached a text file for which I want to apply the filter
to (time702.txt).
Here is what I am doing...
> dyn.load("C:/f/NEW/filter2d.dll")
> is.loaded("filter2d")
[1] TRUE
Then I pass the
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 =
2003 Mar 21
5
manipulating "..." inside a function
Dear R-help,
Can some one tell me how to do the following (if it's possible)?
Suppose I have a function like this:
f <- function(x, y, ...) {
## some code
g(x, y, ...)
## some more code
}
The problem is that g() may not understand everything that comes through in
"...". Is there a way to delete some component of "..." and then pass it to
g()?
Here's
2006 Aug 01
2
Indexing issue
Hi,
R is having the following weird behavior and I am not sure if that is a
feature or a bug:
I am working on the following "3D" array:
> bIm
, , 1
[,1]
[1,] TRUE
[2,] TRUE
[3,] TRUE
[4,] TRUE
[5,] TRUE
> class(bIm)
[1] "array"
> dim(bIm)
[1] 5 1 1
When I try to get the first 2D subarray, the whole thing folds into a
vector:
> bIm[,,1]
[1] TRUE TRUE TRUE
2007 Nov 24
1
ragged array with append
I wonder what's the right way in R to do the following -- placing
objects of the same kind together in subarrays of varying length.
Here's what I mean:
> word <- c("a","b","c","d","e","f","g","h","i","j")
> kind <- c(1,1,1,2,3,4,5,5,7,7)
> d <-
2005 Nov 23
4
x[1,], x[1,,], x[1,,,], ...
Hi,
is there a function in R already doing what I try to do below:
# Let 'x' be an array with *any* number of dimensions (>=1).
x <- array(1:24, dim=c(2,2,3,2))
...
x <- array(1:24, dim=c(4,3,2))
i <- 2:3
ndim <- length(dim(x))
if (ndim == 1)
y <- x[i]
else if (ndim == 2)
y <- x[i,]
else if (ndim == 3)
y <- x[i,,]
else ...
and so on. My current
2008 Sep 23
1
error receiving files from protocol 29 server
In debian bug #493559 (http://bugs.debian.org/493559) the problem is
that when requesting a file from an older version rsync, the remote
server gives an error:
$ rsync rsync://rsync.blackholes.us/zones/countries/countries.rbl /tmp
rsync: on remote machine: -: unknown option
rsync error: requested action not supported (code 4) at clientserver.c(517)
rsync: connection unexpectedly closed (4 bytes
2006 Aug 11
2
Array#chunk method, maybe someone will find this useful
class Array
# break an array up into <size> chunks
def chunk(size=1)
return self if self.empty?
raise ArgumentError if !size.kind_of? Integer
y = self.length.divmod(size)
rows = (y[1] > 0) ? y[0] + 1 : y[0]
arr = Array.new(rows)
(0...rows).each do |i|
arr[i] = self.slice(size*i, size)
end
(arr.last.length...size).each { |i| arr.last[i] = nil }
2004 May 06
2
rsync-2.6.2: NFS clients confused after an rsync
We use rsync to update an nfs server. After an update, we noticed that
a large number of clients didn't see the updated data.
It took me a while to be able to reliably reproduce this problem, but it
happens on old and new versions of rysnc. It also happens across all
the platforms we use here (sun/linux/netapp).
This shows the problem: [Note my home directory is NFS mounted]
2003 Oct 03
2
Cygwin/rsync Hang Problem Testing Results
People of cygwin & rsync,
I recently attempted to get cygwin and rsync working to solve a
backup/mirroring need in my computer life. Well, as you might guess, I
ran into a little but of trouble.
Strangely enough, rsync seemed to be regularly hanging when I attempted
to do a "get" (sycronize a remote to a local dir). Well, considering I
want to automate this, that was not going
2001 Aug 06
1
merge rsync+ into rsync (was Re: rsync-2.4.7 NEWS file)
> Just curious: what about the rsync+ patch?
Thanks for the reminder.
I've just committed Jos's rsync+ patch onto the
"branch_mbp_rsyncplus_merge" branch. If it works OK and nobody
screams I will move it across onto the main tree tomorrow or
Wednesday.
I see the patch doesn't add documentation about the new options to the
man page, so we should fix that in the future.
2005 Mar 17
1
odd behaviour change (2.6.3 > 2.6.4pre3)
Synopsis: Prior to the 2.6.4pre versions, issuing 'rsync rsync://host/module/' behaved effectively as 'ls -l'. I've toyed with various options in an attempt to get an 'ls -l' style output, but to no avail.
As I have a small handful of scripts that rely on this no-longer-functioning functionality, this could be considered a Bad Thing(TM).
Following is an example of
2008 Jun 18
1
subarray
Hello everyone,
I am trying to subset a matrix with the following code:
dat<-read.table(file="C:\\Documents and Settings\\Owner\\My Documents\\Yeast\\Yeast.txt",header=T,row.names=1)
file.show(file="C:\\Documents and Settings\\Owner\\My Documents\\Yeast\\Yeast.txt")
Z.matrix<-as.matrix(dat)
Y<-array(dat,dim(,[46:63])
but I keep getting the error message: error in dim
2013 Sep 24
2
Protocol negotiation issue in rsync
I was trying to use rsync to send files to a fileserver using an rssh
restricted server.
It refuses, saying that trying to override the shell with -e is forbidden. I
didn't type "-e".
When I look at the source, I see
/* Checking the pre-negotiated value allows --protocol=29 override. */
if (protocol_version >= 30) {
/* We make use of the -e
2002 May 22
1
rsyncd listing of directories
I just took a look at the 2.5.5 codebase to see how easy it would be to
write a little driver script that downloads a big directory tree from an
rsync daemon the chunky way (get a list of a module's subdirectories and
do the transfer by subdirectory). The reason for doing this is obvious
when you have large directory trees, as is the case for many of us.
Unfortunately the way list_only is
2009 Feb 01
0
[LLVMdev] Performance vs other VMs
This is not a quite fair comparison. Other virtual machines must be
doing garbage collection, while LLVM, as it is using C code, it is
taking advantage of memory allocation by hand.
On Fri, Jan 30, 2009 at 9:56 PM, Jon Harrop <jon at ffconsultancy.com> wrote:
>
> The release of a new code generator in Mono 2.2 prompted me to benchmark the
> performance of various VMs using the