search for: res1

Displaying 20 results from an estimated 268 matches for "res1".

Did you mean: res
2013 Jan 07
2
how to aggregate T-test result in an elegant way?
Dear all: Plan 1: I want to do serval t-test means for different variables in a loop , so I want to add all results to an object then dump() them to an text. But I don't know how to append T-test result to the object? I have already plot the barplot and I want to know an elegant way to report raw result. Can anybody give me some pieces of advice? Yao He ????????????????????????? Master
2004 Jun 01
1
swapping with data.frame
Hi there, I have some data which are convenient to enter as lists. For example: t1<-list(fname="animal1",testname="hyla",dspkr="left",res1=39.7,res2=15.0) t2<-list(fname="animal1",testname="bufo",dspkr="left",res1=14.4,res2=56.1) t3<-list(fname="animal2",testname="hyla",dspkr="right",res1=22.6,res2=11.8) I would like to generate a dataframe, but *not* the way this appr...
2012 Jan 04
1
function in R for my exercise
...;divide") res=x/y else res<-NA return(res)} Then, I tried to include some lines to take this "swap" function into account by "splitting" somehow my function in 2: myFunc<- function(x,y,z,swap) { res1= NULL res2=NULL if(z =="plus") res1=x+y else if(z=="minus") res1=x-y else if(z== "multiply") res1=x*y else if(z=="divide") res1=x/y else res1<-...
2013 May 22
0
calcul of the mean in a period of time
...se y; data.frame(patient_id=unique(y1$patient_id),t=head(y1$t,1),scores=mean(y1$scores,na.rm=TRUE))}) ) }) lst1[lapply(lst1,length)==0]<-lapply(lst1[lapply(lst1,length)==0],function(x) x<- dat2[unlist(with(dat2,tapply(t,patient_id,FUN=function(x) x==0 & length(x)==1)),use.names=FALSE),]) res1<-do.call(rbind,lst1) ?row.names(res1)<- 1:nrow(res1) ?res2<- res1[,-2] res2$period<-with(res2,ave(patient_id,patient_id,FUN=seq_along)) ?res2 # patient_id scores period #1????????? 1?? 2.05????? 1 #2????????? 2?? 2.40????? 1 #3????????? 2?? 2.05????? 2 #4????????? 3?? 1.20????? 1 #5????...
2013 Nov 21
1
how can I import a number of datsets in a folder in my working directory to a list in R
...86,ncol=2); write.table(m1,paste0("file_",i,".txt"),row.names=FALSE,quote=FALSE)}) ?D <-dir() D1 <- D[order(as.numeric(gsub("\\D+","",D)))] D1 ?res <- t(sapply(D1,function(x) {x1<- read.table(x,header=TRUE); x1[,2]})) dim(res) #[1]?? 15 1686 #or res1 <- do.call(rbind,lapply(D1,function(x) {x1<- read.table(x,header=TRUE); x1[,2]})) ?dim(res1) #[1]?? 15 1686 ?dimnames(res) <- dimnames(res1) ?identical(res,res1) #[1] TRUE A.K. I have a folder containing 15 text files in my working directory. ?I want to use the dir() function D<-di...
2013 Mar 14
0
reshape
...NU" "TANNU" "TANNU" "TANNU" ... # $ year???? : int? 1935 1935 1935 1935 1935 1935 1935 1935 1935 1935 ... # $ month??? : int? 1 1 1 1 1 1 1 1 1 1 ... # $ day????? : int? 1 2 3 4 5 6 7 8 9 10 ... # $ discharge: num? 8.06 7.65 7.3 7.3 6.95 6.95 6.6 6.25 5.9 5.61 ... res1<-lapply(split(dat2,dat2$st),function(x) dcast(x,day~year,mean,value.var="discharge")) ?length(res1) #[1] 124 ?which(lapply(res1,nrow)>366) #this is what I mentioned #CURVO GHIST READO TERCA UZZCO #?? 34??? 52??? 82?? 115?? 118 nrow(res1$CURVO) #[1] 730 ?nrow(res1$CURVO) #[1] 730...
2006 Aug 18
1
multivariate analysis by using lme
Dear R users, I have a data structure as follows: id two res1 res2 c1 c2 inter 1 -0.786093166 1 0 1 2 6 3 -0.308495749 1 0 0 1 2 5 -0.738033048 1 0 0 0 1 7 -0.52176252 1...
2011 Apr 05
2
IFELSE function XXXX
Hello everyone, This IFELSE function call is not working properly. I do not receive an error message, but the actions are not executed conditional as I was hoping. Any assistance is appreciated. set.seed(12345) res1<-rbinom(10000,1,.1) rdata3<-transform(data.frame(res1),input1=rnorm(10000,50,10)) data3 #inducing correlation between res1 & input1 ifelse(data3$res1==1,data3$input1<-data3$input1+10,data3$input1<-data3$input1) data3 Thank you, Dan [[alternative HTML version deleted]]
2012 May 27
3
write.csv permissions
Dear R help, I have a doubt regarding the write.csv function.? When I save a file (write.csv(res1,"res1.csv")), it is saving with the read-only permission.? I tried to change the permission as a root user with chmod u+x.? Though, it says that "-rwxr--r--? 1 root root???? 164 2012-05-27 10:18 res1.csv", when I open the file it is still read-only.? Is there any way to save the...
2006 Sep 01
1
integration problem with gamma function
.../ 1000 sH <- ceiling(1000 / (2 * sqrt(Nmin + 3))) / 1000 L <- floor(100 * (smin + 1) / (Nmax + 2)) / 100 H <- 1 - L return(c(Di, si, Dii, sii, sL, sH, L, H)) } #END BLOCK # -------------------------------------------------- Si <- 11 Ni <- 15 Sii <- 10 Nii <- 16 smin <- 0 res1 <- SucRatesIntBounds(Ni, Si, Nii, Sii, smin) res1 #return(c(Di, si, Dii, sii, sL, sH, L, H)) names(res1) <- c("Di","si","Dii","sii","sL","sH","L","H") res1 Di <- res1[1] si <- res1[2] Dii <- res1[3] sii...
2005 Jul 19
1
initial points for arms in package HI
...) ## density DichteGam <- function(x, u = para, v = para) { exp(-(u*x + v*1/x) - log(x))/c } ## calculating 1000 values by repeating a call of arms (this would ## be the situation in an Gibbs Sample. Of course in a Gibbs sampler ## the distribution would change. This is only for demonstration res1 <- NULL for(i in 1:1000) res1[i] <- arms(runif(1,0,100), logDichteGam, function(x) (x>0)&(x<100), 1) ## Generating a sample of thousand observations with 1 call of arms res2 <- arms(runif(1,0,100), logDichteGam, function(x) (x>0)&(x<100), 1000) ## Plot of the sample...
2013 Apr 29
1
how to add new rows in a dataframe?
...??????? 3.6 2???????????????? 4??????????????????????? 5.6 2???????????????? 6??????????????????????? 7.8 3???????????????? 0??????????????????????? 1.6 3???????????????? 1???????????????????????? 1.2 3???????????????? 4???????????????????????? 1.5 ",sep="",header=TRUE) library(zoo) res1<-do.call(rbind,lapply(split(dat1,dat1$id),function(x) {t1<-seq(min(x$t),max(x$t));scores1<-na.locf(x$scores[match(t1,x$t)]);data.frame(id=rep(unique(x$id),length(t1)),t1,scores1)})) ?row.names(res1)<- 1:nrow(res1) ?res1 #?? id t1 scores1 #1?? 2? 0???? 1.2 #2?? 2? 1???? 1.2 #3?? 2? 2???...
2013 May 07
4
how to calculate the mean in a period of time?
...????????????? 2???????????????? 2.5 2????????????????????? 4????????????????? 2.6 2?????????????????????? 5???????????????? 1.5 ",sep="",header=TRUE) library(plyr) ?dat2New<-ddply(dat2,.(patient_id),summarize,t=seq(min(t),max(t))) ?res<-join(dat2New,dat2,type="full") res1<-do.call(rbind,lapply(split(res,res$patient_id),function(x) {x1<-x[x$t!=0,];do.call(rbind,lapply(split(x1,((x1$t-1)%/%3)+1),function(y) {y1<-if(any(y$t==1)) rbind(x[x$t==0,],y) else y; data.frame(patient_id=unique(y1$patient_id),scores=mean(y1$scores,na.rm=TRUE))}) ) })) ?row.names(res1)&l...
2013 Feb 17
6
histogram
HI Elisa, You could use ?cut() vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45) label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep="")))
2003 Aug 21
4
anova(lme object)
Hi, I use lme to fit models like R> res1 <- lme(y~A+B, data=mydata, random=~1|subject) R> res2 <- lme(y~B+A, data=mydata, random=~1|subject) (only difference between these two models are the sequence in which the indep variables are written in formula) where y is continuous and A, B, and subject are factors. To get ANOVA table...
2000 Jul 05
1
Tukey.aov with split-plot designs
...ionnaires" data <- c(30,14,24,38,26,28,18,20,34,28,16,10,18,20,14,34,22,30,44,30) Stv.df <- data.frame(rt=data,subj=factor(rep(paste("subj",1:5,sep=""),4)),drug=factor( rep(paste("drug",1:4,sep=""),c(5,5,5,5)))) res0 <- aov(rt~drug,data=Stv.df) res1 <- aov(rt~drug+subj,data=Stv.df) res2 <- aov(rt~drug+Error(subj/drug),data=Stv.df) res0$resid works resid(res0) works res0$df.residual works res1$resid works resid(res1) works res1$df.residual work res2$resid doesn't work and reports NULL resid(res2) doesn't work and reports NULL r...
2006 Feb 27
1
Different deviance residuals in a (similar?!?) glm example
...6, 3) # just as example deaths.sim <- rpois(length(age), exposures*hazard.sim) # simulating deaths from a poisson distribution (Brillinger, 1986) my.offset <- log(exposures) # offset for the poisson regression # new dataset: decupleing the sample size deaths.sim1 <- deaths.sim * 10 exposures1 <- exposures * 10 my.offset1 <- log(exposures1) # fitting the first dataset fit <- glm(formula = deaths.sim ~ age + offset(my.offset), family = poisson(link = "log")) res <- residuals(fit, type="deviance") # fitting the new dataset fit1 <- glm(fo...
2011 Aug 04
1
How to get the test statistic corresponding to the p-value in mtable?
...ect or mtable? Here is a short example: # Run this #################### install.packages("memisc") library(memisc) set.seed(1) data1 <- rnorm(400) dim(data1) <- c(100,4) data1 <- as.data.frame(data1) names(data1) <- c("y",paste("x",1:3,sep="")) res1 <- glm(y~x1+x2,data=data1) res2 <- glm(y~x2+x3,data=data1) mtable("Model 1"=res1,"Model 2"=res2) ############################# Cheers, Erich [[alternative HTML version deleted]]
2012 Oct 26
3
regression analysis in R
Dear useRs, i have vectors of about 27 descriptors, each having 703 elements. what i want to do is the following 1. i want to do regression analysis of these 27 vectors individually, against a dependent vector, say B, having same number of elements.2. i would like to know best 10 regression results, if i do regression analysis of dependent vector against the random combination of any 4
2013 Sep 25
1
Computing calculation among two vectors
Hi, Try: x<- 1:4 ?y<- c("*","/","-","+") res<-sapply(y,function(i) {x1<-expand.grid(x,x); unlist(lapply(paste0(x1[,1],i,x1[,2]),function(u) eval(parse(text=u))))}) row.names(res)<- as.character(interaction(expand.grid(x,x),sep="_")) head(res) #??? *?? /? - + #1_1 1 1.0? 0 2 #2_1 2 2.0? 1 3 #3_1 3 3.0? 2 4 #4_1 4 4.0? 3 5 #1_2 2 0.5