Displaying 20 results from an estimated 40000 matches similar to: "sort matrix based on a specific order"
2009 Feb 12
3
get top 50 correlated item from a correlation matrix for each item
Hi,
I have a correlation matrix of about 3000 items, i.e., a 3000*3000
matrix. For each of the 3000 items, I want to get the top 50 items that
have the highest correlation with it (excluding itself) and generate a
data frame with 3 columns like ("ID", "ID2", "cor"), where ID is those
3000 items each repeat 50 times, and ID2 is the top 50 correlated items
with ID,
2005 Jan 11
4
Matrix to "indexed" vector
I have a matrix that I want to turn into a transformed matrix that
includes the indices from the original matrix and the value. The
matrix is simply real-valued and is square (and large (8k x 8k)). I
want something that looks like (for the 3x3 case):
i j value
1 1 1.0
1 2 0.783432
1 3 -0.123482
2 1 0.783432
2 2 1.0
2 3 0.928374
and so on....
I can do this with for loops, but there is
2003 Apr 02
7
Index of item in matrix
Hello All,
Is there a fast way to find the index(row and column) of a point in a
matrix?
Thanks,
John.
--
--------------------------------------------------------------------------
Dr. John Janmaat
Department of Economics, Acadia University, Wolfville, NS, B4P 2R6
E-mail: jjanmaat at acadiau.ca Web: http://ace.acadiau.ca/~jjanmaat
Tel: 902-585-1461 Fax: 902-585-1070
2011 Mar 19
3
create a matrix with values from data.frame
Hello,
I'm trying to create a matrix (95x55) with data from a data.frame pop:
xloc yloc go ind Ene totW
1 23 20 516 1 0.02 20.21
2 23 20 1143 1 0.02 20.21
3 23 20 250 1 0.02 20.21
4 22 15 251 1 0.02 18.69
5 22 15 598 1 0.02 18.69
6 21 19 250 1 0.02 20.21
7 22 20 251 1
2002 Jul 12
2
Crosstabs in R
Before I reinvent the wheel, I have need for a relatively straightforward
crosstabulation (2 x n) function. I know that R has table(), ftable(),
xtabs(), and summary(xtabs()), but none of these produce a fully "tricked"
out cross-tabulation with marginal totals, expected cell frequencies, and
an array of statistics about the contingency table.
Is there a more complete (something
2006 Mar 15
1
Setting xlim in lattice plots
I am having difficulty setting different xlim values in the lattice
histogram plot function.
An example is shown below. I think I need to convert the limits data.frame
to a list of paired values but don't know how. Any help would be
appreciated.
library(lattice)
mat <- as.data.frame(matrix(abs(c(rnorm(100),
10*rnorm(100),20*rnorm(100),30*rnorm(100))),ncol=4))
2005 Feb 07
4
proportional matrix rows
Hi
I have a two-column integer matrix like this:
R> jj
[,1] [,2]
[1,] -1 1
[2,] -2 2
[3,] -7 6
[4,] -8 7
[5,] -6 5
[6,] -9 8
[7,] -5 4
[8,] 3 -3
[9,] -10 9
[10,] -4 3
I want a diagnostic that detects whether a row is a multiple of
the first row or not. In this case, this would be rows 1,2, and 8.
How to do this
2006 Jun 26
2
compare odds ratios
Hi there, is there any way to compare 2 odds ratios? I
have two tests that are supposed to detect a disease
presence. So for each test, I can compute an odds
ratio. My problem is how can I compare the 2 tests by
testing whether the 2 odds ratios are the same?
Appreciate
2006 Feb 14
3
Inf values in a matrix
Hello,
I have some Inf values in a matrix, but I don't want to replace them with
some value but rather remove the rows that contain the Inf values. Also I
would like to record the rows which were removed. Is there an easy way to
do this instead of writing loops over the matrix? Thanks.
Ita Cirovic Donev
2009 Sep 10
2
index of min elements in matrix
Hi, All,
How can I get the indices of the minimum elements in a matrix without using
a loop?
For example, if the matrix is
4 5 2
2 8 9
5 2 3
Then I want to output (1,3), (2,1), (3,2).
Thanks,
Annie
[[alternative HTML version deleted]]
2010 Feb 26
7
How to add a variable to a dataframe whose values are conditional upon the values of an existing variable
Hi everyone,
I am at my wits end with what I believe would be considered simple by a more experienced R user. I want to know how to add a variable to a dataframe whose values?are conditional?on the values of an existing?variable.?I can't seem to make an ifelse statement work?for my situation.?The existing variable?in my dataframe is?a character variable named DOW which contains abbreviated
2011 Oct 10
1
Linear programming problem, RGPLK - "no feasible solution".
In my post at https://stat.ethz.ch/pipermail/r-help/2011-October/292019.html I included an undefined term "ej". The problem code should be as follows. It seems like a simple linear programming problem, but for some reason my code is not finding the solution.
obj <- c(rep(0,3),1)
col1 <-c(1,0,0,1,0,0,1,-2.330078923,0)
col2 <-c(0,1,0,0,1,0,1,-2.057855981,0)
col3
2011 Mar 27
6
Asking Favor For the Script of Median Filter
Hello,everybody. My name is Chuan Zun Liang. I come from Malaysia. I am just
a beginner for R. Kindly to ask favor about median filter. The problem I
facing as below:
> x<-matrix(sample(1:30,25),5,5)
> x
[,1] [,2] [,3] [,4] [,5]
[1,] 7 8 30 29 13
[2,] 4 6 12 5 9
[3,] 25 3 22 14 24
[4,] 2 15 26 23 19
[5,] 28 18 10 11 20
This
2008 Jun 11
3
searching for specific row in matrix
Hi,
I have matrix of bits and a target vector. Is there an
efficient way to search the rows of the matrix for the target?
I am interested in the first row index where target is found.
Example:
> source("lookup.R")
[,1] [,2] [,3] [,4] [,5]
[1,] 1 0 1 1 0
[2,] 1 1 0 1 0
[3,] 0 0 1 0 0
[4,] 1 0 0 1 1
[5,]
2009 Apr 21
6
Sampling in R
[This email is either empty or too large to be displayed at this time]
2012 May 17
2
Complex sort problem
Dear List,
Is there a way I can sort a sample based on a sort index constructed from
the data from which the sample is taken? Basically, I need to take 'many'
samples from the same source data and sort them. This can be very time
consuming for long vectors. Is there any way I can sort the data only once
initially, and use that sort order for the samples?
I believe that idea is what is
2010 Dec 21
3
logistic regression or not?
Hi, I have a dataset where the response for each person on one of the 2
treatments was a proportion (percentage of certain number of markers being
positive), I also have the number of positive & negative markers available for
each person. what is the best way to analyze this kind of data?
I can think of analyzing this data using glm() with the attached dataset:
2008 Feb 14
5
Removing columns that are all NA from a matrix
Hi,
I guess this might be a FAQ or something, and there's probably a nice
simple way to do it, but I can't think of it:
Given a matrix, I want to remove columns that are _entirely_ filled with
NAs (partial NAs are fine).
How please?
Thanks,
Martin
2008 Mar 30
2
Alignment and Reshaping of the matrix
Dear R users,
I have a matrix like
85 .90 86 .89 87 .98 86 .87
88 .98 90 .78 88 .76 89 .56
90 .67 95 .67 89 .89 90 .87
91 .56 96 .87 90 .76 92.98
each pair of columns present a variable name and next the value. I have
matrix with more than 500 rows and column.
Now I want to convert this matrix in to.
85 .90 00 .00 00
86 .00 .89 .00 .87
87 .00 00 .98 00
88 .98 00 .76
2012 Dec 17
2
Suggestion: 'method' slot for format.ftable()
Dear R-developers,
I would like to suggest a 'method' slot for format.ftable() (see an adjusted
'format.ftable()' below, taken from the source of R-2.15.2).
At the moment, format.ftable() contains several empty cells due to the way the
row and column labels are printed. This creates problems (= unwanted empty
columns/rows) when converting an ftable to a LaTeX table; see an