Displaying 20 results from an estimated 300 matches similar to: "efficient filtering of matrices"
2005 Apr 26
2
Advice for calling a C function
Hi,
I'm having some trouble with a bit of combined C & R code. I'm trying to
write a C function to handle the for loops in a function I'm working on
to calculate a similarity matrix. Jari Oksanen has kindly added the
necessary changes to the vegan package so that I can use the vegdist
function, so this isn't absolutely necessary. However, I'm stubborn and
want to know
2005 Apr 26
2
Advice for calling a C function
Hi,
I'm having some trouble with a bit of combined C & R code. I'm trying to
write a C function to handle the for loops in a function I'm working on
to calculate a similarity matrix. Jari Oksanen has kindly added the
necessary changes to the vegan package so that I can use the vegdist
function, so this isn't absolutely necessary. However, I'm stubborn and
want to know
2011 Jun 23
2
Confidence interval from resampling
Dear R gurus,
I have the following code, but I still not know how to estimate and extract
confidence intervals (95%CI) from resampling.
Thanks!
~Adriana
#data
penta<-c(770,729,640,486,450,410,400,340,306,283,278,260,253,242,240,229,201,198,190,186,180,170,168,151,150,148,147,125,117,110,107,104,85,83,80,74,70,66,54,46,45,43,40,38,10)
x<-log(penta+1)
plot(ecdf(x),
2010 Mar 26
2
Odd results with %% and conserving memory
Can anyone explain this?
I have a matrix with double components. It's taking up a lot of memory, so I
want to multiply then turn it to integers. I'm pretty certain that there are
only 2 decimal places, but I wanted to check by using modulo. E.g.
mat = matrix(11:50/100, ncol=4,nrow=10) #Matrix with values out to the
hundredths
any((mat * 100)%%1!=0)
But oddly enough it doesn't work.
2011 Mar 08
1
Replacing values in a data.frame/matrix
Hi all,
Suppose we have the following matrix
m <- matrix(c(1,2,3,2,1,3,3,1,2), ncol = 3, byrow=T)
where in each row each number occurs only once.
I'd like to define a permutation, e.g. 1 -> 2, 2 -> 1, 3 -> 3 and apply
it to the matrix. Thus, the following matrix should result:
m.perm <- matrix(c(2,1,3,1,2,3,3,2,1), ncol = 3, byrow=T)
i.e. each 1 should map to 2 and vice
2007 Oct 16
1
error in sample ()
I am trying to get a random matrix based on an original matrix called
disperser.mx, with dimensions 30x73
When I write the following code:
>scramble = sample (disperser.mx)
>newmat = matrix(scramble, nrow=30)
I get the following warning message and a very weird matrix with 30 rows but
only 3 columns shown below:
Warning message:
data length [73] is not a sub-multiple or multiple of the
2013 Nov 22
2
[LLVMdev] new dragonegg 3.4 warning on darwin12
Duncan,
Is this expected for x86_64-apple-darwin12 under Xcode 5? Using current
llvm/compiler-rt/clang/polly/testsuite with dragonegg 3.4 branch, I see
the warnings...
% /sw/lib/gcc4.8/bin/gcc-4 -fplugin=/sw/lib/gcc4.8/lib/dragonegg.so -specs=/sw/lib/gcc4.8/lib/integrated-as.specs -fplugin-arg-dragonegg-enable-gcc-optzns -Ofast himenoBMTxpa.c
himenoBMTxpa.c: In function ‘main’:
2007 Aug 21
1
Random Sampling from a Matrix
Dear Friends,
I have a matrix of size 5000 X 20. The first two columns are indicator variables taking the value of either 0 or 1. Let us call the first two columns Y1 and Y2.
I need to randomly sample 1000 rows with all the associated columns, in other words my new matrix should be of size 1000 X 20. I realize that using this command
newmat <- mainmat[sample(1000,replace=F),]
achieves
2005 May 31
2
simple predict question
Excuse the simple question...
I'm not sure what I'm doing wrong with predict, but let me use this example:
Suppose I do:
dat<-matrix(c(0,0,10,20),2,byrow=T)
lm1<-lm(dat[,2]~dat[,1])
Suppose I want to generate the linearly-interpolated y-values between the
point (0,0) and (0,20) at every unit interval.
I thought I just do:
predict(lm1, data.frame(seq(0,10,1))) to get
2012 Oct 26
1
Creating a correlation matrix from a vector
I'm looking to create a correlation matrix, but I have already obtained the
correlations, which are stored in a vector. (Basically, I'm running a
simulation which requires a correlation matrix, but I am simulating the
various correlations.)
My aim is to create a function that can take the vector, and fit the values
into their respective locations in a correlation matrix. (The correlations
2013 Nov 22
0
[LLVMdev] new dragonegg 3.4 warning on darwin12
On Thu, Nov 21, 2013 at 07:37:46PM -0500, Jack Howarth wrote:
> Duncan,
> Is this expected for x86_64-apple-darwin12 under Xcode 5? Using current
> llvm/compiler-rt/clang/polly/testsuite with dragonegg 3.4 branch, I see
> the warnings...
>
> % /sw/lib/gcc4.8/bin/gcc-4 -fplugin=/sw/lib/gcc4.8/lib/dragonegg.so -specs=/sw/lib/gcc4.8/lib/integrated-as.specs
2007 Aug 24
1
uneven list to matrix
Hello,
I am sure I am not the only person with this problem.
I have a list with n elements, each consisting of a single column matrix
with different row lengths. Each row has a name ranging from A to E. Here
is an example:
alph[[1]]
A 1
B 2
C 3
D 4
alph[[2]]
A 1
C 3
D 4
alph[[3]]
A 1
D 4
E 5
I would like to create a matrix from the elements in the list with n
columns such that the row names
2001 Oct 09
3
Unlisting while preserving object types?
Hi
A toy example is probably the least ambiguous way of explaining what I'm
trying to do.
> library(ts)
> zz<-list(a=rnorm(100),b=rt(100,3))
> zz.spec<-lapply(zz,spectrum,plot=F)
> summary(zz.spec)
Length Class Mode
a 15 spec list
b 15 spec list
I'm looking for an elegant way to fetch components of the sub-lists a and b
of zz.spec;
e.g. to make a matrix
2005 May 24
3
obtaining first and last record for rows with same identifier
I have a dataframe that contains fields such as patid, labdate, labvalue.
The same patid may show up in multiple rows because of lab measurements on
multiple days. Is there a simple way to obtain just the first and last
record for each patient, or do I need to write some code that performs that.
Thanks,
Steven
2005 Aug 31
5
"best" c++ matrix library?
Hi folks,
I am planning to write some more time-consuming matrix manipulations
in c++. What is the experience with the existing c++ matrix
libraries? Do you have some recommendations? Are some libraries more
compatible with R than the others?
All suggestions welcome!
Best,
Ott
2007 Dec 19
0
leaps
Thank you very much for the example. I think interactively I could get
something.
But my obstacle is to write an R script that processes my set of data
automatically.
My difficulty is to extract the information that appears on the screen, when
R is operated interactively, from a scripts.
Let me go over some steps to make sure I am doing things right.
Assume my data have been read into the matrix
2008 Jan 29
2
help on establishing a matrix
I am a beginner and this is a naive question.
I have the following data set.
row column height
1 2 96
3 7 67
9 25 77
......
I have a matrix of 50*100 data points and about 60% of them are zeros.
I want to put the height data into the matrix according to their row and column numbers. does anybody have experience in setting up such matrix?
Your help is highly appreciated.
Jack
LSU
2010 Apr 05
1
strange behavior of matrix
Dear R list,
I have discovered a seemingly peculiar feature when using a matrix to
index itself (yes, this is strange code, which I have now modified to
be more reasonable).
#this makes sense
s <- matrix(1:3,nrow=1)
s[s] #all three elements are shown
#but when I try
s <- matrix(1:2,nrow=1)
s[1] #fine, the first element is shown
s[2] #fine, the second element is
2012 Nov 12
1
reshape
Hi,
I have a R output that looks as follow:
Rad:0
Rad1:2
Rad3:3
I want to make a new matrix that looks like : sample size is 2400
Variable n11 n12
Rad 0 2400-0=2400
Rad1 2 2400-2
Rad3 3 2400-3
Thanks a lot for your time and help:)
Best,Farnoosh Sheikhi
[[alternative HTML version deleted]]
2005 May 06
2
2 simple questions
Please excuse what I'm sure are very easy questions but I'm relatively new
to the R environment.
How can I view a range of list elements, but not all. e.g., I had a matrix
of patients and then split them out by patient id. I know I can do
patlist[[1]] to see the first one, but how can I view, say, the first ten
patients?
My other question is how to count how many patients have a