Displaying 20 results from an estimated 600 matches similar to: "how to take multiple subsets from a matrix"
2006 Oct 19
2
arraytake for extracting subarrays from multidimensional arrays
Hi,
I recently encountered a problem with array subsetting and came up with a
fix. Given an array of arbitrary dimensions, in which the number of
dimensions is only known at runtime, I wanted to extract a subarray. The
main issue with doing this is that in order to extract a subarray from an
array of (say) 4 dimensions you usually specify something like this
a.subarray <- a[,c(4,2),1:5,]
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
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
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
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
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 <-
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 }
2012 May 19
0
Re: [RFC PATCH 0/7] bcache: md conversion
Dan Williams wrote:
> The consensus from LSF was that bcache need not invent a new interface
> when md and dm can both do the job. As mentioned in patch 7 this series
> aims to be a minimal conversion. Other refactoring items like
> deprecating register_lock for mddev->reconfig_mutex are deferred.
>
> This supports assembly of an already established cache array:
>
>
2010 Dec 18
0
What's wrong with these mail headers?
When moderating this message just now I forwarded it to
r-help-owner, for discussion.
In reply to Roy's question, there is indeed nothing obvious
which should "match a filter rule". However, the ETHZ spam
filter is somewhat sensitive about gmail, regardless of true
content, and there are 4 occurrences of "gmail.com", which
may have been responsible for it.
Looking at the
2006 Mar 10
1
what's wrong with my "cov"?
Hi all,
Why cov(y, y) only gives one value, and cov(t(y), t(y)) gives 3x3 NA matrix?
Here my y is listed below and it is a 3x1 matrix.
I am expecting that if I have a random vector y=[y1 y2 y3]', here " ' "
denotes a transposition so that
y is a column vector, where y1, y2, y3 are independent random variables...
then cov(y, y) should be
E[ y * y' ] - E[y] * E[y] ',
2008 Nov 13
2
CROSSTABULATION
I want to form a 3x3 crosstabulation for the signs of two vectors (i.e.
Negative, Zero, Positive). The problem is that I am simulating the data so
for some iterations one of the categories is absent. Thus the resulting
table shrinks to 3x2. I want it to be 3x3 with zero column corresponding to
the missing category. Moreover, I have tried but failed to give the
dimension names.
--
Sohail Chand
2003 Oct 06
1
visualizing transition probability matrices
Dear List,
I have a couple of (~200) 3x3 transition probability matrices (ie each
defines a Markov chain). They are all estimated from the same
underlying process, so it ie meaningful to take their elemetwise mean
and standard deviation. [1]
First question: supposing that they are given in a list l, how do I
get their elementwise mean and standard deviation? Fortunately, the
mean of trans. prob.
2011 May 10
1
Saving multiple 3x3 TIFF graphics inside a loop
Dear Friends,
I have been trying to save multiple 3x3 (mfrow=c(3,3) graphics inside a loop
using tiff figure format (not using PDF or savePlot functions) with no
success. Could you please help?
Here is a simplified example code:
dat=data.frame (ID=rep(1:10,each=10),IDV=rep(seq(1:10),times=10))
dat$DV <- with(dat, 50+15*IDV)
dat=dat[order(dat$ID,dat$IDV),]
for(i in 1:10){
dt1 =
2010 Jan 14
5
To add text in a matrix
Dear colleagues,
I would need to add text (some rows of information) in a matrix. For example, given this matrix
1 2 3
4 5 6
7 8 9
I would need to add this info:
THIS IS AN EXAMPLE
OF a 3x3 MATRIX
1 2 3
4 5 6
7 8 9
I have been looking for a function that works similar to "fopen" in matlab, but unfortunately I have not found It in R.
Thank you in advance for your help!
Carlos
2005 Dec 16
2
multiple plots per page
R-help,
I would like to place nine (3X3) plots per page. I am not properly
implement mfrow(3,3) in the script below:
jpeg("xyplot.jpg") #names output file
my_args <- commandArgs() #sets up to take args from dos batch command
mfcol(3,3) #set page for 3X3
TEMPS <- c(-15,25,85)#list of temps
VBATS <- c(3,3.6,4.7)#list of Bats
BOARDS <-
2010 Oct 04
1
Fisher exact test?
Hi All,
My apologies if this is a totally newbie question.
I want to calculate the probability that a particular set of genes is picked
repeatedly for 3 samplings. For example, if from a total of 'N' genes, I pick
'A' number of genes in the first pick, 'B' number of genes in the second pick,
and 'C' number of genes in the third pick, I would want to calculate
2010 Oct 31
1
How to control in order of groups in xyplot
Hi guys,
I used the following R code to generate one plot
library(lattice)
xyplot(Y~X1|as.factor(X2)*as.factor(X3), groups = as.factor(X4),
data=mydata)
Both X2 and X3 have three values. X4 has two values. I got 3x3 grids and in
each grid there are two curves about y~x1 for the two X4 values. I am quite
happy with the plot except that I need a different layout of the 3x3 layout.
For example,
2010 Jul 07
1
xyplot of function only shows diagonal plots
I expected this script to show nine panels, each with a plot of the
function.
But when I run it, only the diagonal panels have content.
Executing > print(trel_1) shows what I expected in the upper left corner.
I am using R ver. 2.11.0 and lattice ver. 0.18-8 on Windows XP under
Eclipse and StatET.
I have searched the documentation, but found no answer. What am I missing?
--- simple.R ---
#
2016 Feb 17
2
Openswan <-> VyOS
Hello,
I'm having a bit of trouble connecting our current CentOS Openswan server
with a Vyos server via IPSec.
I've posted this on the VyOS forums, but haven't had many helpful
responses, so I thought I would ask here.
http://forum.vyos.net/showthread.php?tid=26504&pid=29703#pid29703
Basically our Openswan configuration is as follows:
conn VYOS
keyingtries=0