Hello,
Your matrix has only 4 columns but you refer to met[,5]. I'll assume
you're refering to the last column, met[,4]. Try reading the help page
for ?%in%, it doesn't do what you seem to think it does. And try using <=.
maf <- met[0 <= met[, 4] & met[, 4] <= 0.05, ]
Hope this helps,
Rui B
Hi there,
I have a matrix and I want to get a subset from that which one of its
matrix meet a condition,
my matrix is
met
Row.names Name
maf caf
1 10:13915 10:139 0.0003782148
0.0003782148
2 10:18738 10:1873
Maybe that:
su <- lapply(dat[2:5],function(x)table(x))
su
mode(su)
myBYdata <- data.frame( do.call(cbind,lapply(su, as.data.frame)) )
myBYdata
У Няд, 23/01/2011 у 07:43 -0500, Wei Yang піша:
> Dear all,
>
> I would like to ask whether anyone has experience with the problem below.
>
>
> I want
I think there are multiple solutions that match your criteria. Here is one:
dat <- structure(list(Id = 1:20, v1 = c(1L, 2L, 4L, 1L, 3L, 3L, 3L,
+ 4L, 1L, 4L, 2L, 1L, 2L, 4L, 3L, 2L, 1L, 2L, 4L, 3L), v2 = c(2L,
+ 1L, 2L, 1L, 2L, 1L, 4L, 4L, 2L, 1L, 4L, 4L, 3L, 3L, 2L, 3L, 4L,
+ 3L, 1L, 3L), v3 = c(
Dear all,
I would like to ask whether anyone has experience with the problem below.
I want to select a subset of the sample (see data below) so that each level
(1,2,3,4 in the example) for every variable (v1,v2,v3,v4 in the example) is
shown at least once in the subset. I also want the sample s
How about something like:
censor_choose <- function(fr)
do.call(rbind,
lapply( split( fr, fr$id),
function(sub)
sub[which.max( if (max(sub$censor))
sub$censor
else sub$time)
,] ) )
Using your data,
itc <-
data.frame(id=c(1,1,1,2
gallon li schrieb:
> for id 1, i want to select the last row since all censor indicator is 0; for
> id 2, i want to select the row where censor ==1; for id 3, i also want to
> select the row where censor==1. So if there is a 1 for censor, then I want
> to select such a row, otherwise I want to sele
I have the complete data like
id time censor
1 10 0
1 20 0
1 30 0
2 10 0
2 20 1
2 30 0
2 40 0
3 10 0
3 20 0
3 30 1
for id 1, i want to select the last row since all censor indicator is 0; for
id 2, i want to select the row where censor ==1; for id 3, i also want to
select the row where censo
8 matches
Mail list logo