Displaying 20 results from an estimated 2143 matches for "m1".
2010 Nov 29
3
how to use by() ?
Hello, All!
How might one accomplish this using the by() function?
m1 is a data frame.
# populate column "m1$major_allele"
for ( i in 1:length(m1$major_allele)) {
if ( m1$Freq1[i] == m1$MAF[i]){
m1$major_allele[i] = m1$Al1[i]
}
else{
m1$major_allele[i] = m1$Al2[i]
}
}
Jim
[[alternative HTML version deleted]]
2013 Mar 29
3
if clause in data frame
Hi,
final<-data.frame()
?? for (m1 in 4:10) {
?????? for (n1 in 4:10){?
?????????? for (x1 in 0: m1) {
????????????? for (y1 in 0: n1) {
final<- rbind(final,c(m1,n1,x1,y1))
res}}}}
?final1<-within(final,{flag<-ifelse(x1/m1>y1/n1, 1,0)})
?head(final1)
#? m1 n1 x1 y1 flag
#1? 4? 4? 0? 0??? 0
#2? 4? 4? 0? 1??? 0
#3? 4? 4?...
2006 Mar 13
3
hfsc and dropped packets
Hi,
I''m trying to get a handle on hfsc. Here is my configuration:
root@jmnrouter:/jmn# tc class show dev vlan1
class hfsc 1: root
class hfsc 1:1 parent 1: ls m1 0bit d 0us m2 225000bit ul m1 0bit d 0us m2
225000bit
class hfsc 1:10 parent 1:1 rt m1 191000bit d 25.0ms m2 135000bit ls m1 0bit
d 0us m2 135000bit ul m1 0bit d 0us m2 225000bit
class hfsc 1:20 parent 1:1 rt m1 22008bit d 25.0ms m2 56008bit ls m1 0bit d
0us m2 56008bit ul m1 0bit d 0us m2 225000bi...
2010 Jun 16
2
data frame
Dear list,
I have the following problem. I have a data frame like this
CLUSTER YEAR variable Delta R_pivot
M1 2005 EC01 NA NA
M1 2006 EC01 2 NA
M1 2007 EC01 4 5
M2 2005 EC01 NA...
2010 Nov 29
2
FW: how to use by() ?
...result is not quite what I would like. Here's sample code for you or anyone else who may be interested:
Al1 = c('A','C','C','C')
Al2 = c('G','G','G','T')
Freq1 = c(0.0078,0.0567,0.9434,0.9908)
MAF = c(0.0078,0.0567,0.0566,0.0092)
m1 = data.frame(Al1=Al1, Al2=Al2,Freq1=Freq1,MAF=MAF,major_allele='')
m1
Al1 Al2 Freq1 MAF major_allele
1 A G 0.0078 0.0078
2 C G 0.0567 0.0567
3 C G 0.9434 0.0566
4 C T 0.9908 0.0092
Using the suggestion involving "...
2006 Apr 23
2
distribution of the product of two correlated normal
Hi,
Does anyone know what the distribution for the product of two correlated
normal? Say I have X~N(a, \sigma1^2) and Y~N(b, \sigma2^2), and the
\rou(X,Y) is not equal to 0, I want to know the pdf or cdf of XY. Thanks
a lot in advance.
yu
[[alternative HTML version deleted]]
2018 May 09
3
NAs produced by integer overflow, but only some time ...
I have problem with integer overflow that I cannot understand.
I have a character vector curr.lemmas with the following properties:
length(curr.lemmas) # 61224
length(unique(curr.lemmas)) # 2652
That vector is the input to the following function:
yules.k1 <- function(input) {
m1 <- length(input); temp <- table(table(input))
m2 <- sum("*"(temp, as.numeric(names(temp))^2))
return(10000*(m2-m1) / (m1*m1))
}
When I run this, I get the following output:
[1] NA
Warning message:
In m1 * m1 : NAs produced by integer overflow
But when I change the functi...
2013 Mar 10
0
max row
HI,
Using
c11<- 0.01
c12<- 0.01
c1<- 0.10
c2<- 0.10
One possible problem is that:
dim(res5)
#[1] 513? 20
res6<-aggregate(.~m1+n1+m+n,data=res5[,c(1:6,9:12,21:24)] ,max)
#Error in `[.data.frame`(res5, , c(1:6, 9:12, 21:24)) :
?# undefined columns selected
A.K.
________________________________
From: Joanna Zhang <zjoanna2013 at gmail.com>
To: arun <smartpink111 at yahoo.com>
Sent: Saturday, March 9, 2013...
2020 Aug 11
2
M[cbind()] <- assignment with Matrix object loses attributes
...a sparse Matrix via M[X]<-..., where X is a
2-column matrix, appears to drop user-assigned attributes. I dug around
in the R code for Matrix trying to find the relevant machinery but my
brain started to hurt too badly ...
?? Will submit this as a bug if it seems warranted.
library(Matrix)
m1 <- matrix(1:9,3,3)
m1 <- Matrix(m1)
attr(m1,"junk") <- 12
stopifnot(isTRUE(attr(m1,"junk")==12))? ## OK
m1[cbind(1:2,2:3)] <- 1
stopifnot(isTRUE(attr(m1,"junk")==12)) ## not OK
attr(m1,"junk") ## NULL
## note I have to use the ugly stopifnot(isT...
2010 Jun 17
1
big big problem
Dear list,
I'll try to be more clear in explaining my problem. I have a data frame like this called X:
CLUSTER YEAR variable value1 value2
M1 2005 EC01 NA NA
M1 2006 EC01 2 5
M1 2007 EC01 4 5
M2 2005 EC01 NA...
2013 Feb 01
29
cumulative sum by group and under some criteria
...error massage.
Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) :
Group length is 0 but data length > 0
On Thu, Jan 31, 2013 at 12:21 PM, arun kirshna [via R] <
ml-node+s789695n4657196h87@n4.nabble.com> wrote:
> Hi,
> Try this:
> colnames(d)<-c("m1","n1","x1","y1","p11","p12")
> library(zoo)
> res1<- do.call(rbind,lapply(lapply(split(d,list(d$m1,d$n1)),function(x)
> {x$cp11[x$x1>1]<- cumsum(x$p11[x$x1>1]);x$cp12[x$y1>1]<-
> cumsum(x$p12[x$y1>1]);x}),functi...
2006 Sep 19
0
How to interpret these results from a simple gamma-frailty model
Dear R users,
I'm trying to fit a gamma-frailty model on a simulated dataset, with 6 covariates, and I'm running into some results I do not understand. I constructed an example from my simulation code, where I fit a coxph model without frailty (M1) and with frailty (M2) on a number of data samples with a varying degree of heterogeneity (I'm running R 2.3.1, running takes ~1 min).
library(survival); set.seed(10000)
lambda <- 0.01 # Exp. hazard rate
# Beta coefficients for Age,TC,HDLC,SBP,Diab,Smok
beta <- c(0.0483,0.0064,-0.0270...
2010 Apr 14
5
Running cumulative sums in matrices
Dear R-helpers,
I have a huge data-set so need to avoid for loops as much as possible. Can someone think how I can compute the result in the following example (that uses a for-loop) using some version of apply instead (or any other similarly super-efficient function)?
example:
#Suppose a matrix:
m1=cbind(1:5,1:5,1:5)
#The aim is to create a new matrix with every column containing the cumulative sum of all previous columns.
m2=m1
for(i in 2:ncol(m1)){
m2[,i]=apply(m1[,1:i],1,sum)
}
m2
Many thanks in advance
Eleni Rapsomaniki
Research Associate
Strangeways Research Laboratory
Department...
2011 Mar 08
2
plotCI() with ggplot2
Hello
Currently, I plot some coefficients with some intervals using
function "plotCI()" (package "gplots") using the following code:
(m1 <- matrix(0:5, nrow=2, byrow=T, dimnames=list(c("v1", "v2"),
c("lo", "m", "hi"))))
m2 <- m1 + 1
library(gplots)
plotCI(
x=1:length(m1[, 1]),
pch="",
xlab="v1/v2",
xlim=c(1-.2, length(m1[, 1])+.2),
ylim=c(-...
2005 Dec 09
1
Residuals from GLMMs in the lme4 package
Hello there
This is the first time I have used r-help message board so I hope I have got
the right address.
I am trying to check the residuals of a GLMM model(run using the package
lme4). I have been able to check the residiuals of REMLs in lme4 using the
following:
m1<-lmer(vTotal~Week+fCollar+ (1|fCat), collars)
res<-resid(m1)
plot(res)
qqnorm(res)
library(MASS)
par(mfrow=c(2,3))
res<-residuals(m1)
truehist(res,main="Histogram of Residuals")
curve(dnorm(x,mean=mean(res),sd=sd(res)),add=TRUE)
qqnorm(fitted(m1),resid(m1), ylim=range(fitted(m1)...
2004 Jul 13
1
MLE, precision
Hi, everyone
I am trying to estimate 3 parameters for my survival
function. It's very complicated. The negative
loglikelihood function is:
l<- function(m1,m2,b) -sum( d*( log(m1) + log(m2)
+ log(1- exp(-(b + m2)*t)) ) + (m1/b - d)*log(m2 +
b*exp(-(b + m2)*t) ) + m1*t - m1/b*log(b+m2) )
here d and t are given, "sum" means sum over these
two vairables.
the parameters are assumed small, m1, m2 in
thousandth, m2 in millionth.
I use...
2011 Dec 03
1
partial mantel tests in ecodist with intential NA values.
...t.ecodist will not accept data with NA values, returning a "matrix is not square error.
is it possible to perform this test in ecodist?
many thanks
Nevil Amos
> library(ecodist)
> library(ncf)
> x<-sample(1:1000,20)
> y<-sample(1:1000,20)
> z<-sample(1:1000,20)
> M1<-as.matrix( distance(x))
> M2 <-as.matrix( distance(y ))
> M3<-as.matrix( distance(z ))
> D1<-(lower(M1))
> D2<-(lower(M2))
> D3<-(lower(M3))
> mantel(D1 ~ D2+D3, nperm=1000)
mantelr pval1 pval2 pval3 llim.2.5% ulim.97.5%
0.09014696 0.10300000...
2018 May 09
0
NAs produced by integer overflow, but only some time ...
...overflow that I cannot understand.
>
>I have a character vector curr.lemmas with the following properties:
>
>length(curr.lemmas) # 61224
>length(unique(curr.lemmas)) # 2652
>
>That vector is the input to the following function:
>
>yules.k1 <- function(input) {
> m1 <- length(input); temp <- table(table(input))
> m2 <- sum("*"(temp, as.numeric(names(temp))^2))
> return(10000*(m2-m1) / (m1*m1))
>}
>
>When I run this, I get the following output:
>
>[1] NA
>Warning message:
>In m1 * m1 : NAs produced by integer ov...
2013 Jun 27
2
[LLVMdev] Problem with linking modules which use a shared type
Hi,
I stumbled upon a strange thing regarding types and module linking, which I don't quite get, so maybe someone around here can enlighten me.
Consider the following code, which will create 2 modules m1 and m2, and a named structured type %T = { i32 }; m1 contains only a function definition f(%T), m2 contains a function declaration f(%T) and a function definition h(%T), where h will call f in its body. Note that all functions in m1 and m2 are based upon the same structured type %T:
LLVMConte...
2004 Mar 26
4
cbind/rbind fail on matrixes containing lists (PR#6702)
Today's R 1.9.0 beta:
> m1
[,1] [,2] [,3] [,4]
[1,] NA NA NA NA
[2,] NA NA NA NA
[3,] NA NA NA NA
[4,] NA NA NA NA
> class(m1[1,1])
[1] "list"
> cbind(m1,m1)
Error in cbind(...) : cannot create a matrix from these types
> rbind(m1,m1)
Error in rbind(...) : cannot create...