Displaying 20 results from an estimated 10000 matches similar to: "match help"
2007 Sep 05
3
list element to matrix
I have created a list of "matrices" using sapply or lapply and wish to extract each of the "matrices" as a matrix. Some of them are 2x2, 3x3, etc.
I can do this one at a time as:
M1<-as.matrix(D[[1]])
How can repeat this process for an unknown number of entries in the list? In other words, how shall I index M1?
Diana
2007 Nov 09
1
help with lasso2 package
X is a matrix and F is a vector.
F2 <- data.frame(cbind(X,F))
F2
V1 V2 V3 F
1 -0.250536332 -1.4755883 1.9580974 -2.136487
2 -0.009856084 0.4953269 0.5486092 -2.744482
3 -0.406962682 0.7729631 0.1861905 -2.891821
4 1.938780097 0.7469251 1.2537781 -1.212992
5 -0.332370358 1.1943637 0.7114278 -1.830441
modF<-formula(F ~ V1 + V2 + V3) #no error message
2007 Apr 26
3
adding a column to a matrix
i would like to add a variable to an existing matrix by manipulating 2 previous variables eg for the data
m
treat strata censti survTime
[1,] 1 2 284.684074 690.4961005
[2,] 1 1 172.764515 32.3990335
[3,] 1 1 2393.195400 24.6145279
[4,] 2 1 30.364771 8.0272267
[5,] 1 1 523.182282 554.7659501
l
2008 Jun 17
5
How to control height of abline
I use matplot to get the density curve and then I use
abline(v=g$V2, col = 3 ) to get the vertical line.
Goal : I want very small lines at the bottom on the x axis , if possible in the arrow forms instead of vertical lines on the whole graph.
Thanks a lot.
[[alternative HTML version deleted]]
2007 Feb 22
3
List filtration
Hello R-ologists,
Imagine you have a list "list" like so:
>list
[[1]]
[1] "IPI00776145.1" "IPI00776187.1"
[[2]]
[1] "Something" "IPI00807764.1" "IPI00807887.1"
[[3]]
[1] "IPI00807764.1"
[[4]]
[1] "Somethingelse"
What I need to achieve is a filtered list "list2" like so:
>list2
[[1]]
[1]
2008 Jun 11
4
Matrix transformation problem
ng,
I have a matrix (x) with binary content. Each row of the matrix holds exactly one 1, and the rest of the row is zeros. The thing is that I need to 'collapse' the matrix to one column where each row holds the original column index of the 1's (y). Sometimes, the matrix is quite large, so I have a perfomance problem.
x <- matrix(c(1,0,0, 0,0,1, 0,1,0, 0,0,1, 0,1,0,
2007 Feb 05
3
Confidence intervals of quantiles
Can anyone please tell me if there is a function to calculate confidence
intervals for the results of the quantile function.
Some of my data is normally distributed but some is also a squewed
distribution or a capped normal distribution. Some of the data sets contain
about 700 values whereas others are smaller with about 100-150 values, so I
would like to see how the confidence intervals change
2007 Jun 01
2
how to extract the maximum from a matrix?
Dear UseRs,
I have a very simple question. I have a big matrix (say x) including
probabilities (values in (0,1)).
I have to store in a list the names of the row and the column where max(x)
is located. How can I proceed?
Thanks in advance for your assistance!
mirko
2006 Mar 10
3
Sweave scientific real display format (e.g. 5e-12)
Dear All,
I couldn't figure and couldn't google out how to make construct a pair of
\Sexpr s or a LaTeX macro that would include
5\cdot 10^{-12}
into the LaTeX output istead of
5e-12 .
Any ideas?
Thank you
G?bor
2006 Sep 07
1
Running wilcox.test function on two lists
Dear all,
I'm a newbie to R and I would really apperciate any help with the following:
I have two lists, l1 and l2:
l1:
$"A*0101"
[1] 0.076 0.109 0.155 0.077 0.09 0 0 0.073
[9] 0.33 0.0034 0.0053
$"A*0247"
[1] 0 0 0.5 .004 0 0 0
$"A*0248"
[1] 0 0 0.3 0 0.06
....
l2:
$"A*1101"
[1] 0.17 0.24 0.097 0.075 0.067
$"A*0247"
numeric(0)
2006 Dec 07
2
Splitting a dataframe at the results of tapply
I have got a dataframe containing measurement of aircraft noise like
this:
> Id <- c(1,4,5,2,3,6,4,1,2,5,6,3)
> Noise <- c(88,94,97,98,92,56,103,102,87,95,92,97)
> Height <- c(190, 150, 120, 115, 188, 104, 101, 189, 146, 111, 124,
126)
>
> df <- data.frame(Id, Noise, Height)
Now I would like to split this in two new dataframes. The first one
containing the rows
2008 May 08
2
speeding up a special product of three arrays
I am struggling with R code optimization, a recurrent topic on this list.
I have three arrays, say A, B and C, all having the same number of columns.
I need to compute an array D whose generic element is
D[i, j, k] <- sum_n A[i, n]*B[j, n]*C[k, n]
Cycling over the three indices and subsetting the columns won't do. Is there
any way to implement this efficiently in R or should I resign to
2005 Apr 19
2
indexing an array using an index-array, but one entry being ', '
Hi
I have the following array:
test <- array(c(1:16), dim = c(3,4,3))
test
## I call some enries using an index array
test.ind <- array(rbind(c(1,2,1), c(3,3,2)), dim = c(2,3))
test[test.ind]
## suppose I want all values in the 2nd row and 4th col over
## all three 3rd dimensions
test[2,4,]
how to specify a test.ind array with the last index left with ',' i.e
test.ind should be
2008 Mar 10
1
How can I sample from a two-dimensional grid of points
Hi everyone,
My goal is to sample from a two-dimensional grid. Consider the following example of code:
n.grid <- 500
muA.grid <- seq(-4,4, length=n.grid)
muB.grid <- seq(-4,4, length=n.grid)
mu.p <- matrix(NA, nrow=n.grid, ncol=n.grid)
for(i in 1:n.grid){
for(j in 1:n.grid){
mu.p[i,j] <- dnorm(muA.grid[i], 0, 1)*dnorm(muB.grid[j], 0, 0.5)
}
}
mu.p <-
2007 Jun 08
4
match rows of data frame
Hi R-experts,
I have a data frame (A) , and a subset (B) of this data frame. I am trying
to create a new data frame which gives me all the rows of B, plus the 5th
next row(occuring in A). I have used the below code, but it gives me all 5
rows after the matching row. I only want the 5th.
FiveDaysLater <- A[c(sapply(match(rownames(B),rownames(A)), seq,
length=6))),]
Any guidance much
2007 Jun 11
1
Gini coefficient in R
If I use the Ineq library and the Gini function in this way:
>Gini(c(100,0,0,0))
I obtain the result 0.75 instead of 1 (that is the perfect inequality).
I think Gini's formula in Ineq is based on a formula as reported here:
http://mathworld.wolfram.com/GiniCoefficient.html
but in the case of perfect inequality:
x_1=.......=x_n-1 =0
x_n>0
these formula are equal to 1 - 1/n, not to
2008 Jul 22
2
Table orderd by frequencies
Dear List,
I try to order the output of a table by the frequencies of the vector I
am look at.
The object I am looking at is a factor with a lot of levels that were
named only once.
Therefore it would be much easier to order the output by the frequencies
of the levels.
E.g.
> levels(a)
"a" "b" "c" "d"
Preferred outcome:
table(a)
b c a d
10 5 1 1
2006 Jun 07
2
Help with sample function
I have generated some some survival times and censoring indicators.
Thus I have an ordered pair for each observation. How do I sample these
ordered paris? I only know how to sample from a vector? I would
appreciate any help I could get.
Thanks
Matt
2008 Mar 27
2
colMeans in a data.frame with numeric and character data
Hi all,
I would like to know if it is posible by, someway, to get colMeans from
a data.frame with numeric as well as character data, dispersed all over
the object. Note that I would like to get colMeans neglecting character
data.
I am really in need of some function proceeding in that way…
All the best
Diogo André Alagador
[[alternative HTML version deleted]]
2005 Feb 21
5
Compare rows of two matrices
Hello,
#I have two matrices, eg.:
y <- matrix( c(20, NA, NA, 45, 50, 19, 32, 101, 10, 22, NA, NA, 80, 49, 61, 190), ncol=4 )
x <- matrix( c(20, NA, NA, NA, 50, 19, 32, 101, 10, 22, NA, NA, 80, 49, 61, 190), ncol=4 )
#Whereas x contains all NA?s from y plus some additional NA?s.
#I want to find the index of these additional NA?s. I think, there must be a very