Displaying 20 results from an estimated 2000 matches similar to: "Creating Multiple Repeating samples and Cross Correlating them."
2006 May 17
1
Column notation
Hello,
I would like to run a correlation on values in a table that
has 4 rows and 136 columns. However, I am only interested in
correlating the values in alternating blocks of 15 columns.
For example, I would like to correlate the values in row 1,
columns 2-16:31-46:61-76:91-106 with values in row 2, columns
2-16:31-46:61-76:91-106.
Is there a way to notate this in the cor command so that the
2010 Jul 15
2
replace negative numbers by smallest positive value in matrix
Hi Group,
I have a matrix, and I would like to replace numbers less than 0 by
the smallest minimum number. Below is an
small matrix, and the loop I used. I would like to get suggestions on
the "R way" to do this.
Thanks,
Juliet
# example data set
mymat <- structure(c(-0.503183609420937, 0.179063475173256, 0.130473004669938,
-1.80825226960127, -0.794910626384209, 1.03857280868547,
2017 Jun 27
2
paste strings in C
Dear R-devs,
Below is a small example of what I am trying to achieve, that is trivial in
R and I would like to learn how to do in C, for very large matrices:
> (mymat <- matrix(c(1,0,0,2,2,1), nrow = 2))
[,1] [,2] [,3]
[1,] 1 0 2
[2,] 0 2 1
And I would like to produce:
[1] "a*C" "B*c"
Which can be trivially done in R via something like:
foo
2008 Sep 21
1
How to put given values in lower triangle of splom-plot?
Dear R-experts,
I have found a splom-modification online which is given below. This
works perfectly, but I would like to have a matrix of given
correlation values to be used in the lower triangular part
(lower.panel) of the splom-plot instead of calculated correlation
values. Here is the matrix I would like to use (it can be any other
convenient data structure):
2007 Mar 12
1
How to avoid a for-loop?
Hi all,
as I am trying to move slowly from just "working" to "good" code, I'd
like to ask if there's a smarter way than using a for-loop in tasks like
the example below.
I need to obtain the extrema of the cumulated sum of a detrended time
series. The following code is currently used, please have a look at the
comments for my questions and remarks:
system.time({
X
2009 Aug 26
3
changing equal values on matrix by same random number
Dear all,
I have about 30,000 matrix (512x512), with values from 1 to N.
Each value on a matrix represent a habitat patch on my
matrix (i.e. my landscape). Non-habitat are stored as ZERO.
No I need to change each 1-to-N values for the same random
number.
Just supose my matrix is:
mymat<-matrix(c(1,1,1,0,0,0,0,0,0,0,0,
0,0,0,0,2,2,2,0,0,0,0,
0,0,0,0,2,2,2,0,0,0,0,
3,3,0,0,0,0,0,0,0,4,4,
2011 Oct 01
1
class definition
Hi everybody!
I have a matrix of class "myClass", for example:
myMat <- matrix(rnorm(30), nrow = 6)
attr(myMat, "class") <- "myClass"
class(myMat)
When I extract part of ''myMat'', the corresponding class ''myClass'' unfortunately disappear:
myMat.p <- myMat[,1:2]
class(myMat.p)
Please for any advice / suggestions, how
2006 Mar 21
1
rownames, colnames, and date and time
I noticed something surprising (in R 2.2.1 on WinXP)
According to the documentation, rownames and colnames are character vectors.
Assigning a vector of class POSIXct or POSIXlt as rownames or colnames
therefore is not strictly according to the rules.
In some cases, R performs a reasonable typecast, but in some other cases
where the same typecast also would be possible, it does not.
Assigning a
2006 Mar 21
1
rownames, colnames, and date and time
I noticed something surprising (in R 2.2.1 on WinXP)
According to the documentation, rownames and colnames are character vectors.
Assigning a vector of class POSIXct or POSIXlt as rownames or colnames
therefore is not strictly according to the rules.
In some cases, R performs a reasonable typecast, but in some other cases
where the same typecast also would be possible, it does not.
Assigning a
2013 Apr 25
1
problem with geom_point in ggplot using a different column
I want to draw boxplot where the geom_points are displayed based on
"ERBB2.MUT" subset and they should be displayed in the right box (based
both on the "ERBB2.2064" field and "ERBB2_Status").
However, given my command I currently only see "red" points corresponding
to "MUT" subset in one straight line corresponding to only "ERBB2.2064"
2006 Jul 03
1
rownames, colnames, and date and time
Hi all
I was wondering whether there has ever been an update on the rownames and
colnames behaviour as described by Eric below?
I still get the same behaviour, exactly as described by Eric, on my WinXP
installation of R-2.3.0. I also posted a message to r-help on Friday but
looking through the online archives it seems to have not made it to the
list. I would agree with Eric that a consistent
2005 Apr 15
4
function corresponding to map of perl
Is there a function in R that corresponds to the
function ``map'' of perl?
It could be called like:
vector.a <- map( vector.b, FUN, args.for.FUN )
It should execute for each element ele.b of vector.b:
FUN( vector.b, args.for.FUN)
It should return a vector (or data.frame) of the results
of the calls of FUN.
It nearly works using:
apply( data.frame( vector.b ), 1, FUN,
2012 Oct 30
3
boxplots of various levels
noob here
trying to make boxplots of some data
i would like to separate the boxplots according to conditons of various
levels
for example:
i have
group:1 and 2, each group performed tests consisting of
condition A,B,C,D
side: left and right
time: 1 to 10
I would like separate boxplots of the results (x) of the tests (numeric) for
each group under each condition on each side over time.
so far i
2011 Aug 25
2
How to store the output of a loop into a matrix??
Hello,
I want to create a matrix of N random numbers with a uniform distributions. Later, I want to repeat T times each row of this matrix. For this I do the following loop:
N<-45
T<-10
n<-N*T
a<-matrix(runif(N,min=-1,max=1),nr=N)
mymat<-matrix(rep(NA,n),nr=n,nc=1)
for(i in i:N){
b<-rep(a[i,],T)
mymat[i,]<-b
}
Mi problem is that with this loop I can see the output of the
2009 Dec 04
2
how to seperate a matrix
Hello,
I am working on seperate the matrix to two matrices but got trouble on doing
it. Please give me some suggestions on doing this. Thanks a looooooooooooot!
My original matrix m is as follows for example,
[,1] [,2] [,3]
[1,] 6 8 1
[2,] 5 9 2
[3,] 20 10 3
[4,] 7 11 4
[5,] 8 12 5
[6,] 25 13 6
[7,] 14 14 7
I want to generate two
2010 Jun 10
3
Retrieving the 2 row of "dist" computations
Dear R Gurus,
As you probably know, dist calculates the distance between every two rows of
data. What I am interested in is the actual two rows that have the least
distance between them, rather than the numerical value of the distance
itself.
For example, If the minimum distance in the following sample run is d[14],
which is .3826119, and the rows are 4 & 6. I need to find a generic way to
2012 Nov 16
2
Calculateing means
Dear List,
I have a data matrix with 570 columns containing 95 (samples) with 6 replicates each.
How can I calculate the mean of the replicates for 95 samples?
Thank you.
The information contained in this electronic e-mail transmission and any attachments are intended only for the use of the individual or entity to whom or to which it is addressed, and may contain information that is
2009 Jul 13
1
Add grand mean to every entry in a matrix
Hi,
I have a matrix:
mymat <- matrix(runif(10*4), ncol=4)
I wish to subtract the column means, down the colums, subtract the row means from the rows and add back the grand mean - all the means should be the means of mymat rather than of the new matrix.
How can I do this?
Any help much appreciated.
Thanks
Tom
_________________________________________________________________
2010 Mar 23
2
Adding matrix rows that have the same name?
Does anyone know if there is an R function that will take a matrix like this
jim 1 0 0 0 0 0
jim 0 1 0 0 0 0
jim 0 0 1 0 0 0
bob 1 0 0 0 0 0
bob 0 0 1 0 0 0
harry 0 0 1 0 0 0
harry 0 0 0 1 0 0
harry 0 0 0 0 1 0
harry 0 0 0 0 0 1
and make it like this? (that is, add together rows that have the same name?)
jim 1 1 1 0 0 0
bob
2012 Feb 03
3
strftime - Dates from Excel files
Hi
I have many excel files were the Date field was not declared as date,
so the dates look like this: 1/2/1978
I know that the format is day/month/year
How can I make R change this to Date format?
If I use strftime, I get wrong dates:
dataset=c("1/2/1978")
strftime(dataset,"%d/%m/%Y")
"19/02/0001"
Thanks in advance.